do not paralellize fsw changes
This commit is contained in:
@@ -249,23 +249,21 @@ public sealed class CacheMonitor : DisposableMediatorSubscriberBase
|
||||
|
||||
_ = RecalculateFileCacheSize();
|
||||
|
||||
|
||||
if (changes.Any(c => c.Value.ChangeType == WatcherChangeTypes.Deleted))
|
||||
{
|
||||
var threadCount = Math.Clamp((int)(Environment.ProcessorCount / 2.0f), 2, 8);
|
||||
|
||||
Parallel.ForEach(changes, new ParallelOptions()
|
||||
lock (_fileDbManager)
|
||||
{
|
||||
MaxDegreeOfParallelism = threadCount,
|
||||
},
|
||||
(change) =>
|
||||
foreach (var change in changes)
|
||||
{
|
||||
Logger.LogDebug("FSW Change: {change} = {val}", change.Key, change.Value);
|
||||
_ = _fileDbManager.GetFileCacheByPath(change.Key);
|
||||
});
|
||||
}
|
||||
|
||||
_fileDbManager.WriteOutFullCsv();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task PenumbraWatcherExecution()
|
||||
{
|
||||
@@ -295,13 +293,9 @@ public sealed class CacheMonitor : DisposableMediatorSubscriberBase
|
||||
}
|
||||
}
|
||||
|
||||
var threadCount = Math.Clamp((int)(Environment.ProcessorCount / 2.0f), 2, 8);
|
||||
|
||||
Parallel.ForEach(changes, new ParallelOptions()
|
||||
lock (_fileDbManager)
|
||||
{
|
||||
MaxDegreeOfParallelism = threadCount,
|
||||
},
|
||||
(change) =>
|
||||
foreach (var change in changes)
|
||||
{
|
||||
Logger.LogDebug("FSW Change: {change} = {val}", change.Key, change.Value);
|
||||
if (change.Value.ChangeType == WatcherChangeTypes.Deleted)
|
||||
@@ -313,10 +307,11 @@ public sealed class CacheMonitor : DisposableMediatorSubscriberBase
|
||||
if (change.Value.OldPath != null) _fileDbManager.GetFileCacheByPath(change.Value.OldPath);
|
||||
_fileDbManager.CreateFileEntry(change.Key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_fileDbManager.WriteOutFullCsv();
|
||||
}
|
||||
}
|
||||
|
||||
public void InvokeScan()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user