fix issue extracting file thumbnails in parallel

This commit is contained in:
Ioannis G 2020-05-02 13:14:51 +03:00 committed by GitHub
parent c12dc8e543
commit be3b74d9bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,10 +49,10 @@ namespace Flow.Launcher.Infrastructure.Image
{ {
Stopwatch.Normal("|ImageLoader.Initialize|Preload images cost", () => Stopwatch.Normal("|ImageLoader.Initialize|Preload images cost", () =>
{ {
foreach (string key in _imageCache.Usage.Keys) ImageCache.Usage.AsParallel().ForAll(x =>
{ {
Load(key); Load(x.Key);
} });
}); });
Log.Info($"|ImageLoader.Initialize|Number of preload images is <{_imageCache.Usage.Count}>, Images Number: {_imageCache.CacheSize()}, Unique Items {_imageCache.UniqueImagesInCache()}"); Log.Info($"|ImageLoader.Initialize|Number of preload images is <{_imageCache.Usage.Count}>, Images Number: {_imageCache.CacheSize()}, Unique Items {_imageCache.UniqueImagesInCache()}");
}); });
@ -172,7 +172,7 @@ namespace Flow.Launcher.Infrastructure.Image
path, path,
Constant.ThumbnailSize, Constant.ThumbnailSize,
Constant.ThumbnailSize, Constant.ThumbnailSize,
ThumbnailOptions.None); ThumbnailOptions.ThumbnailOnly);
} }
} }
else else