Skip to content

Add more debug log info for query #3509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1215,10 +1215,14 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
{
_updateSource?.Cancel();

App.API.LogDebug(ClassName, $"Start query with text: <{QueryText}>");

var query = await ConstructQueryAsync(QueryText, Settings.CustomShortcuts, Settings.BuiltinShortcuts);

if (query == null) // shortcut expanded
{
App.API.LogDebug(ClassName, $"Clear query results");

// Hide and clear results again because running query may show and add some results
Results.Visibility = Visibility.Collapsed;
Results.Clear();
Expand All @@ -1233,6 +1237,8 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
return;
}

App.API.LogDebug(ClassName, $"Start query with ActionKeyword <{query.ActionKeyword}> and RawQuery <{query.RawQuery}>");

_updateSource = new CancellationTokenSource();

ProgressBarVisibility = Visibility.Hidden;
Expand All @@ -1253,6 +1259,9 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b

var plugins = PluginManager.ValidPluginsForQuery(query);

var validPluginNames = plugins.Select(x => $"<{x.Metadata.Name}>");
App.API.LogDebug(ClassName, $"Valid <{plugins.Count}> plugins: {string.Join(" ", validPluginNames)}");

if (plugins.Count == 1)
{
PluginIconPath = plugins.Single().Metadata.IcoPath;
Expand Down Expand Up @@ -1321,6 +1330,8 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
// Local function
async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)
{
App.API.LogDebug(ClassName, $"Wait for querying plugin <{plugin.Metadata.Name}>");

if (searchDelay)
{
var searchDelayTime = plugin.Metadata.SearchDelayTime ?? Settings.SearchDelayTime;
Expand Down Expand Up @@ -1359,6 +1370,8 @@ async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)

if (token.IsCancellationRequested) return;

App.API.LogDebug(ClassName, $"Update results for plugin <{plugin.Metadata.Name}>");

if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(resultsCopy, plugin.Metadata, query,
token, reSelect)))
{
Expand Down Expand Up @@ -1448,6 +1461,8 @@ private void RemoveOldQueryResults(Query query)
{
if (_lastQuery?.ActionKeyword != query?.ActionKeyword)
{
App.API.LogDebug(ClassName, $"Remove old results");

Results.Clear();
}
}
Expand Down
Loading