Skip to content

Commit 47cb7a4

Browse files
committed
another check to avoid re-update lastUpdateTime
1 parent 2405af8 commit 47cb7a4

File tree

1 file changed

+5
-3
lines changed
  • Plugins/Flow.Launcher.Plugin.PluginsManager

1 file changed

+5
-3
lines changed

Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public Task InitAsync(PluginInitContext context)
3838
viewModel = new SettingsViewModel(context, Settings);
3939
contextMenu = new ContextMenu(Context);
4040
pluginManager = new PluginsManager(Context, Settings);
41-
_ = pluginManager.UpdateManifest().ContinueWith(_ =>
41+
_manifestUpdateTask = pluginManager.UpdateManifest().ContinueWith(_ =>
4242
{
4343
lastUpdateTime = DateTime.Now;
4444
}, TaskContinuationOptions.OnlyOnRanToCompletion);
@@ -50,6 +50,8 @@ public List<Result> LoadContextMenus(Result selectedResult)
5050
{
5151
return contextMenu.LoadContextMenus(selectedResult);
5252
}
53+
54+
private Task _manifestUpdateTask = Task.CompletedTask;
5355

5456
public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
5557
{
@@ -58,9 +60,9 @@ public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
5860
if (string.IsNullOrWhiteSpace(search))
5961
return pluginManager.GetDefaultHotKeys();
6062

61-
if ((DateTime.Now - lastUpdateTime).TotalHours > 12) // 12 hours
63+
if ((DateTime.Now - lastUpdateTime).TotalHours > 12 && _manifestUpdateTask.IsCompleted) // 12 hours
6264
{
63-
_ = pluginManager.UpdateManifest().ContinueWith(t =>
65+
_manifestUpdateTask = pluginManager.UpdateManifest().ContinueWith(t =>
6466
{
6567
lastUpdateTime = DateTime.Now;
6668
}, TaskContinuationOptions.OnlyOnRanToCompletion);

0 commit comments

Comments
 (0)