mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
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.
This commit is contained in:
parent
3d8fd1d352
commit
7e332fa615
1 changed files with 3 additions and 2 deletions
|
|
@ -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<List<Win32>>(Win32CacheName, Context.CurrentPluginMetadata.PluginCacheDirectoryPath);
|
||||
lock (_lastIndexTimeLock)
|
||||
{
|
||||
|
|
@ -364,6 +365,7 @@ namespace Flow.Launcher.Plugin.Program
|
|||
{
|
||||
_uwps.Add(uwp);
|
||||
}
|
||||
ResetCache();
|
||||
await Context.API.SaveCacheBinaryStorageAsync<List<UWPApp>>(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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue