mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 22:17:22 +01:00
force rescan if auto cleanup removed files
This commit is contained in:
parent
e0603df470
commit
8c535828b9
2 changed files with 6 additions and 4 deletions
|
|
@ -80,7 +80,7 @@ public class PeriodicFileScanner : IDisposable
|
|||
{
|
||||
while (!token.IsCancellationRequested)
|
||||
{
|
||||
RecalculateFileCacheSize();
|
||||
isForced = RecalculateFileCacheSize();
|
||||
if (!_pluginConfiguration.FileScanPaused || isForced)
|
||||
{
|
||||
isForced = false;
|
||||
|
|
@ -101,7 +101,7 @@ public class PeriodicFileScanner : IDisposable
|
|||
InvokeScan();
|
||||
}
|
||||
|
||||
public void RecalculateFileCacheSize()
|
||||
public bool RecalculateFileCacheSize()
|
||||
{
|
||||
FileCacheSize = Directory.EnumerateFiles(_pluginConfiguration.CacheFolder).Sum(f =>
|
||||
{
|
||||
|
|
@ -115,7 +115,7 @@ public class PeriodicFileScanner : IDisposable
|
|||
}
|
||||
});
|
||||
|
||||
if (FileCacheSize < (long)_pluginConfiguration.MaxLocalCacheInGiB * 1024 * 1024 * 1024) return;
|
||||
if (FileCacheSize < (long)_pluginConfiguration.MaxLocalCacheInGiB * 1024 * 1024 * 1024) return false;
|
||||
|
||||
var allFiles = Directory.EnumerateFiles(_pluginConfiguration.CacheFolder)
|
||||
.Select(f => new FileInfo(f)).OrderBy(f => f.LastAccessTime).ToList();
|
||||
|
|
@ -126,6 +126,8 @@ public class PeriodicFileScanner : IDisposable
|
|||
File.Delete(oldestFile.FullName);
|
||||
allFiles.Remove(oldestFile);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task PeriodicFileScan(CancellationToken ct)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<Authors></Authors>
|
||||
<Company></Company>
|
||||
<Version>0.4.9</Version>
|
||||
<Version>0.4.10</Version>
|
||||
<Description></Description>
|
||||
<Copyright></Copyright>
|
||||
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue