fix cleanup of outdated files in filescanner
This commit is contained in:
@@ -197,12 +197,13 @@ public class FileCacheManager : IDisposable
|
|||||||
|
|
||||||
public void RemoveHash(FileCacheEntity entity)
|
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)
|
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.Hash = Crypto.GetFileHash(fileCache.ResolvedFilepath);
|
||||||
fileCache.LastModifiedDateTicks = new FileInfo(fileCache.ResolvedFilepath).LastWriteTimeUtc.Ticks.ToString(CultureInfo.InvariantCulture);
|
fileCache.LastModifiedDateTicks = new FileInfo(fileCache.ResolvedFilepath).LastWriteTimeUtc.Ticks.ToString(CultureInfo.InvariantCulture);
|
||||||
FileCaches.Remove(fileCache.PrefixedFilePath, out _);
|
FileCaches.Remove(fileCache.PrefixedFilePath, out _);
|
||||||
|
|||||||
@@ -237,10 +237,12 @@ public class PeriodicFileScanner : IDisposable
|
|||||||
scannedFiles[validatedCacheResult.Item2.ResolvedFilepath] = true;
|
scannedFiles[validatedCacheResult.Item2.ResolvedFilepath] = true;
|
||||||
if (validatedCacheResult.Item1 == FileState.RequireUpdate)
|
if (validatedCacheResult.Item1 == FileState.RequireUpdate)
|
||||||
{
|
{
|
||||||
|
Logger.Verbose("To update: " + validatedCacheResult.Item2.ResolvedFilepath);
|
||||||
entitiesToUpdate.Add(validatedCacheResult.Item2);
|
entitiesToUpdate.Add(validatedCacheResult.Item2);
|
||||||
}
|
}
|
||||||
else if (validatedCacheResult.Item1 == FileState.RequireDeletion)
|
else if (validatedCacheResult.Item1 == FileState.RequireDeletion)
|
||||||
{
|
{
|
||||||
|
Logger.Verbose("To delete: " + validatedCacheResult.Item2.ResolvedFilepath);
|
||||||
entitiesToRemove.Add(validatedCacheResult.Item2);
|
entitiesToRemove.Add(validatedCacheResult.Item2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,10 @@ public partial class ApiController
|
|||||||
{
|
{
|
||||||
await wc.DownloadFileTaskAsync(downloadUri, fileName).ConfigureAwait(false);
|
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;
|
CurrentDownloads[downloadId].Single(f => string.Equals(f.Hash, hash, StringComparison.Ordinal)).Transferred = CurrentDownloads[downloadId].Single(f => string.Equals(f.Hash, hash, StringComparison.Ordinal)).Total;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user