Skip to content

Commit df62935

Browse files
committed
Keep loading bar until the plugin stop rerun
1 parent 4500956 commit df62935

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,25 +278,24 @@ public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
278278
{
279279
await using var output = await ExecuteQueryAsync(query, token);
280280
var response = await DeserializeResultAsync(output);
281-
_ = TryRerun();
281+
await TryRerun();
282282
return ParseResults(response);
283-
;
284283

285284
async ValueTask TryRerun()
286285
{
287-
while (response.RerunDelay > 0)
286+
while (response.RerunDelay > 0 && !token.IsCancellationRequested)
288287
{
289-
await Task.Delay(response.RerunDelay, token);
290-
if (token.IsCancellationRequested)
291-
return;
292-
await using var output = await ExecuteQueryAsync(query, token);
293-
response = await DeserializeResultAsync(output);
294288
ResultsUpdated?.Invoke(this, new ResultUpdatedEventArgs
295289
{
296290
Query = query,
297291
Results = ParseResults(response),
298292
Token = token
299293
});
294+
295+
await Task.Delay(response.RerunDelay, token);
296+
token.ThrowIfCancellationRequested();
297+
await using var output = await ExecuteQueryAsync(query, token, true);
298+
response = await DeserializeResultAsync(output);
300299
}
301300
}
302301
}

0 commit comments

Comments
 (0)