Remove calling .ToArray() on a ConcurrentDictionary

This commit is contained in:
oSumAtrIX 2022-02-28 02:24:11 +01:00
parent 16e032ea55
commit 4e3d713efe
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4

View file

@ -74,7 +74,7 @@ namespace Flow.Launcher.Infrastructure.Image
// To delete the images from the data dictionary based on the resizing of the Usage Dictionary
// Double Check to avoid concurrent remove
if (Data.Count > permissibleFactor * MaxCached)
foreach (var key in Data.OrderBy(x => x.Value.usage).Take(Data.Count - MaxCached).Select(x => x.Key).ToArray())
foreach (var key in Data.OrderBy(x => x.Value.usage).Take(Data.Count - MaxCached).Select(x => x.Key))
Data.TryRemove(key, out _);
semaphore.Release();
}