From be3b74d9bb48eadb03426fd63095965632fe4366 Mon Sep 17 00:00:00 2001 From: Ioannis G Date: Sat, 2 May 2020 13:14:51 +0300 Subject: [PATCH] fix issue extracting file thumbnails in parallel --- Flow.Launcher.Infrastructure/Image/ImageLoader.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index 567cda146..e5deea023 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -49,10 +49,10 @@ namespace Flow.Launcher.Infrastructure.Image { 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()}"); }); @@ -172,7 +172,7 @@ namespace Flow.Launcher.Infrastructure.Image path, Constant.ThumbnailSize, Constant.ThumbnailSize, - ThumbnailOptions.None); + ThumbnailOptions.ThumbnailOnly); } } else