Skip to content

Commit be3b74d

Browse files
authored
fix issue extracting file thumbnails in parallel
1 parent c12dc8e commit be3b74d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Flow.Launcher.Infrastructure/Image/ImageLoader.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ public static void Initialize()
4949
{
5050
Stopwatch.Normal("|ImageLoader.Initialize|Preload images cost", () =>
5151
{
52-
foreach (string key in _imageCache.Usage.Keys)
52+
ImageCache.Usage.AsParallel().ForAll(x =>
5353
{
54-
Load(key);
55-
}
54+
Load(x.Key);
55+
});
5656
});
5757
Log.Info($"|ImageLoader.Initialize|Number of preload images is <{_imageCache.Usage.Count}>, Images Number: {_imageCache.CacheSize()}, Unique Items {_imageCache.UniqueImagesInCache()}");
5858
});
@@ -172,7 +172,7 @@ private static ImageResult LoadInternal(string path, bool loadFullImage = false)
172172
path,
173173
Constant.ThumbnailSize,
174174
Constant.ThumbnailSize,
175-
ThumbnailOptions.None);
175+
ThumbnailOptions.ThumbnailOnly);
176176
}
177177
}
178178
else

0 commit comments

Comments
 (0)