mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
another check to avoid re-update lastUpdateTime
This commit is contained in:
parent
2405af88a6
commit
47cb7a4ebc
1 changed files with 5 additions and 3 deletions
|
|
@ -38,7 +38,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
viewModel = new SettingsViewModel(context, Settings);
|
viewModel = new SettingsViewModel(context, Settings);
|
||||||
contextMenu = new ContextMenu(Context);
|
contextMenu = new ContextMenu(Context);
|
||||||
pluginManager = new PluginsManager(Context, Settings);
|
pluginManager = new PluginsManager(Context, Settings);
|
||||||
_ = pluginManager.UpdateManifest().ContinueWith(_ =>
|
_manifestUpdateTask = pluginManager.UpdateManifest().ContinueWith(_ =>
|
||||||
{
|
{
|
||||||
lastUpdateTime = DateTime.Now;
|
lastUpdateTime = DateTime.Now;
|
||||||
}, TaskContinuationOptions.OnlyOnRanToCompletion);
|
}, TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||||
|
|
@ -51,6 +51,8 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
return contextMenu.LoadContextMenus(selectedResult);
|
return contextMenu.LoadContextMenus(selectedResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Task _manifestUpdateTask = Task.CompletedTask;
|
||||||
|
|
||||||
public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
|
public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
|
||||||
{
|
{
|
||||||
var search = query.Search.ToLower();
|
var search = query.Search.ToLower();
|
||||||
|
|
@ -58,9 +60,9 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
if (string.IsNullOrWhiteSpace(search))
|
if (string.IsNullOrWhiteSpace(search))
|
||||||
return pluginManager.GetDefaultHotKeys();
|
return pluginManager.GetDefaultHotKeys();
|
||||||
|
|
||||||
if ((DateTime.Now - lastUpdateTime).TotalHours > 12) // 12 hours
|
if ((DateTime.Now - lastUpdateTime).TotalHours > 12 && _manifestUpdateTask.IsCompleted) // 12 hours
|
||||||
{
|
{
|
||||||
_ = pluginManager.UpdateManifest().ContinueWith(t =>
|
_manifestUpdateTask = pluginManager.UpdateManifest().ContinueWith(t =>
|
||||||
{
|
{
|
||||||
lastUpdateTime = DateTime.Now;
|
lastUpdateTime = DateTime.Now;
|
||||||
}, TaskContinuationOptions.OnlyOnRanToCompletion);
|
}, TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue