mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Don't add result to queue unless the query match (plugin event driven update)
Remove the Task.Run because updating result metadata and adding result to queue should not be time wasted.
This commit is contained in:
parent
8f6f2fbf6f
commit
81a02c6e64
1 changed files with 5 additions and 7 deletions
|
|
@ -96,11 +96,9 @@ namespace Flow.Launcher.ViewModel
|
|||
var plugin = (IResultUpdated)pair.Plugin;
|
||||
plugin.ResultsUpdated += (s, e) =>
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
PluginManager.UpdatePluginMetadata(e.Results, pair.Metadata, e.Query);
|
||||
await _resultsUpdateQueue.SendAsync(new ResultsForUpdate(e.Results, pair.Metadata, e.Query, _updateToken));
|
||||
}, _updateToken);
|
||||
PluginManager.UpdatePluginMetadata(e.Results, pair.Metadata, e.Query);
|
||||
if (e.Query.Search == _lastQuery.Search)
|
||||
_resultsUpdateQueue.Post(new ResultsForUpdate(e.Results, pair.Metadata, e.Query, _updateToken));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -428,13 +426,13 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
// Wait 45 millisecond for query change in global query
|
||||
// if query changes, return so that it won't be calculated
|
||||
await Task.Delay(45);
|
||||
await Task.Delay(45, currentCancellationToken);
|
||||
if (!(_lastQuery.Search == query.Search))
|
||||
return;
|
||||
}
|
||||
|
||||
_ = Task.Delay(200, currentCancellationToken).ContinueWith(_ =>
|
||||
{
|
||||
{
|
||||
// start the progress bar if query takes more than 200 ms and this is the current running query and it didn't finish yet
|
||||
if (currentUpdateSource == _updateSource && _isQueryRunning)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue