mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve query async local function
This commit is contained in:
parent
d78599114a
commit
2f4e140fb0
1 changed files with 6 additions and 2 deletions
|
|
@ -1204,16 +1204,20 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
|
||||
// Local function
|
||||
async Task QueryTaskAsync(PluginPair plugin, bool reSelect = true)
|
||||
async ValueTask QueryTaskAsync(PluginPair plugin, bool reSelect = true)
|
||||
{
|
||||
// Since it is wrapped within a ThreadPool Thread, the synchronous context is null
|
||||
// Task.Yield will force it to run in ThreadPool
|
||||
await Task.Yield();
|
||||
|
||||
if (_updateSource.Token.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
IReadOnlyList<Result> results =
|
||||
await PluginManager.QueryForPluginAsync(plugin, query, _updateSource.Token);
|
||||
|
||||
_updateSource.Token.ThrowIfCancellationRequested();
|
||||
if (_updateSource.Token.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
IReadOnlyList<Result> resultsCopy;
|
||||
if (results == null)
|
||||
|
|
|
|||
Loading…
Reference in a new issue