From 7e332fa615a790f5d45abd5f6edfb2ea92e501fa Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 6 Nov 2025 15:29:38 +0800 Subject: [PATCH] Refactor caching and indexing logic Added `ResetCache` calls after clearing `_win32s` and `_uwps` lists to ensure proper cache reset during indexing. Updated logic to return `resultList` after setting cache size and expiration for improved clarity. Removed `await Task.WhenAll` to adjust asynchronous flow in the indexing process. --- Plugins/Flow.Launcher.Plugin.Program/Main.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index f6d48a531..a2dfecff4 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -142,7 +142,7 @@ namespace Flow.Launcher.Plugin.Program entry.SetSize(resultList.Count); entry.SetSlidingExpiration(TimeSpan.FromHours(8)); - + return resultList; }); @@ -335,6 +335,7 @@ namespace Flow.Launcher.Plugin.Program { _win32s.Add(win32); } + ResetCache(); await Context.API.SaveCacheBinaryStorageAsync>(Win32CacheName, Context.CurrentPluginMetadata.PluginCacheDirectoryPath); lock (_lastIndexTimeLock) { @@ -364,6 +365,7 @@ namespace Flow.Launcher.Plugin.Program { _uwps.Add(uwp); } + ResetCache(); await Context.API.SaveCacheBinaryStorageAsync>(UwpCacheName, Context.CurrentPluginMetadata.PluginCacheDirectoryPath); lock (_lastIndexTimeLock) { @@ -393,7 +395,6 @@ namespace Flow.Launcher.Plugin.Program }); Context.API.LogDebug(ClassName, "Start indexing"); - await Task.WhenAll(win32Task, uwpTask).ConfigureAwait(false); }