|
7 | 7 | using System.Threading; |
8 | 8 | using System.Threading.Tasks; |
9 | 9 | using CommunityToolkit.Mvvm.DependencyInjection; |
| 10 | +using Droplex; |
10 | 11 | using Flow.Launcher.Core.ExternalPlugins; |
11 | 12 | using Flow.Launcher.Infrastructure; |
12 | 13 | using Flow.Launcher.Infrastructure.UserSettings; |
@@ -276,27 +277,44 @@ public static ICollection<PluginPair> ValidPluginsForQuery(Query query) |
276 | 277 |
|
277 | 278 | public static async Task<List<Result>> QueryForPluginAsync(PluginPair pair, Query query, CancellationToken token) |
278 | 279 | { |
| 280 | + API.LogDebug(ClassName, $"a"); |
| 281 | + |
279 | 282 | var results = new List<Result>(); |
280 | 283 | var metadata = pair.Metadata; |
281 | 284 |
|
282 | 285 | try |
283 | 286 | { |
| 287 | + API.LogDebug(ClassName, $"b"); |
| 288 | + |
284 | 289 | var milliseconds = await API.StopwatchLogDebugAsync(ClassName, $"Cost for {metadata.Name}", |
285 | 290 | async () => results = await pair.Plugin.QueryAsync(query, token).ConfigureAwait(false)); |
286 | 291 |
|
| 292 | + API.LogDebug(ClassName, $"c"); |
| 293 | + |
287 | 294 | token.ThrowIfCancellationRequested(); |
| 295 | + |
| 296 | + API.LogDebug(ClassName, $"d"); |
| 297 | + |
288 | 298 | if (results == null) |
289 | 299 | return null; |
| 300 | + |
| 301 | + API.LogDebug(ClassName, $"e"); |
| 302 | + |
290 | 303 | UpdatePluginMetadata(results, metadata, query); |
291 | 304 |
|
| 305 | + API.LogDebug(ClassName, $"f"); |
| 306 | + |
292 | 307 | metadata.QueryCount += 1; |
293 | 308 | metadata.AvgQueryTime = |
294 | 309 | metadata.QueryCount == 1 ? milliseconds : (metadata.AvgQueryTime + milliseconds) / 2; |
295 | 310 | token.ThrowIfCancellationRequested(); |
| 311 | + |
| 312 | + API.LogDebug(ClassName, $"g"); |
296 | 313 | } |
297 | 314 | catch (OperationCanceledException) |
298 | 315 | { |
299 | 316 | // null will be fine since the results will only be added into queue if the token hasn't been cancelled |
| 317 | + API.LogDebug(ClassName, $"h"); |
300 | 318 | return null; |
301 | 319 | } |
302 | 320 | catch (Exception e) |
|
0 commit comments