mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 17:57:21 +01:00
fix cleanup of outdated files in filescanner
This commit is contained in:
parent
605c1d3774
commit
14e5b5bb21
3 changed files with 9 additions and 3 deletions
|
|
@ -197,12 +197,13 @@ public class FileCacheManager : IDisposable
|
|||
|
||||
public void RemoveHash(FileCacheEntity entity)
|
||||
{
|
||||
FileCaches.Remove(entity.Hash, out _);
|
||||
Logger.Verbose("Removing " + entity.ResolvedFilepath);
|
||||
FileCaches.Remove(entity.PrefixedFilePath, out _);
|
||||
}
|
||||
|
||||
public void UpdateHash(FileCacheEntity fileCache)
|
||||
{
|
||||
Logger.Debug("Updating hash for " + fileCache.ResolvedFilepath);
|
||||
Logger.Verbose("Updating hash for " + fileCache.ResolvedFilepath);
|
||||
fileCache.Hash = Crypto.GetFileHash(fileCache.ResolvedFilepath);
|
||||
fileCache.LastModifiedDateTicks = new FileInfo(fileCache.ResolvedFilepath).LastWriteTimeUtc.Ticks.ToString(CultureInfo.InvariantCulture);
|
||||
FileCaches.Remove(fileCache.PrefixedFilePath, out _);
|
||||
|
|
|
|||
|
|
@ -237,10 +237,12 @@ public class PeriodicFileScanner : IDisposable
|
|||
scannedFiles[validatedCacheResult.Item2.ResolvedFilepath] = true;
|
||||
if (validatedCacheResult.Item1 == FileState.RequireUpdate)
|
||||
{
|
||||
Logger.Verbose("To update: " + validatedCacheResult.Item2.ResolvedFilepath);
|
||||
entitiesToUpdate.Add(validatedCacheResult.Item2);
|
||||
}
|
||||
else if (validatedCacheResult.Item1 == FileState.RequireDeletion)
|
||||
{
|
||||
Logger.Verbose("To delete: " + validatedCacheResult.Item2.ResolvedFilepath);
|
||||
entitiesToRemove.Add(validatedCacheResult.Item2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,10 @@ public partial class ApiController
|
|||
{
|
||||
await wc.DownloadFileTaskAsync(downloadUri, fileName).ConfigureAwait(false);
|
||||
}
|
||||
catch { }
|
||||
catch (Exception ex) {
|
||||
Logger.Warn(ex.Message);
|
||||
Logger.Warn(ex.StackTrace);
|
||||
}
|
||||
|
||||
CurrentDownloads[downloadId].Single(f => string.Equals(f.Hash, hash, StringComparison.Ordinal)).Transferred = CurrentDownloads[downloadId].Single(f => string.Equals(f.Hash, hash, StringComparison.Ordinal)).Total;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue