Skip to content

Conversation

Copy link

Copilot AI commented Oct 29, 2025

Program indexing fails to complete when users rapidly toggle Flow Launcher during startup or after system resume, causing applications (e.g., Vivaldi, Spotify) to be missing from search results.

Root Cause

Indexing task was fire-and-forget (_ = Task.Run(...)), allowing premature GC or interruption before completion.

Changes

Task Lifecycle Management

  • Store indexing task reference and lock for thread-safe access
  • Wrap indexing in try-catch with proper error logging
lock (_indexingTaskLock)
{
    _indexingTask = Task.Run(async () =>
    {
        try
        {
            await IndexProgramsAsync().ConfigureAwait(false);
            WatchProgramUpdate();
        }
        catch (Exception e)
        {
            Context.API.LogException(ClassName, "Failed to complete program indexing", e);
        }
    });
}

Query Synchronization

Wait for indexing completion (30s timeout) before processing queries:

if (indexingTask != null && !indexingTask.IsCompleted)
{
    await Task.WhenAny(indexingTask, Task.Delay(TimeSpan.FromSeconds(30), token))
        .ConfigureAwait(false);
}

Disposal Safety

Wait for indexing completion (10s timeout) before cleanup to prevent resource disposal during active indexing.

Impact

  • User: Applications now appear reliably after indexing completes
  • Code: Single-file change to Program plugin (+62, -4)
Original prompt

This section details on the original issue you should resolve

<issue_title>BUG: Flow Launcher doesn't finish indexing programs if spammed the shortcut key to launch it while it's starting</issue_title>
<issue_description>### Checks

  • I have checked that this issue has not already been reported.

  • I am using the latest version of Flow Launcher.

  • I am using the prerelease version of Flow Launcher.

Problem Description

If you spam the Flow Launcher launch shortcut key (Mine is LWin) while it's starting, it will infinitely try to index programs without success. Most of the results will work but all applications will not show up.
Example, Vivaldi will not show up, Spotify neither, but if I search a Windows setting or anything else it will show up.

To Reproduce

  1. Run Flow Launcher
  2. Spam the launch shortcut key while it's opening
  3. Try to search for any application

Screenshots

No response

Flow Launcher Version

1.20.2

Windows Build Number

10.0.26100.5074

Error Log

No error occurs.</issue_description>

Comments on the Issue (you are @copilot in this section)

@Jack251970 Can you check if this can help?

https://ci.appveyor.com/project/JohnTheGr8/flow-launcher/builds/52743730/artifacts</comment_new>
<comment_new>@Jack251970
@rottakore I am not sure if #3978 can help. Could you please check if this can help?

https://github.com/Flow-Launcher/Prereleases/releases/tag/v2.0.0.13849</comment_new>
<comment_new>@Jack251970
Thanks for your reply! I think we need further investigation into this.</comment_new>
<comment_new>@Jack251970
I observed that this problem seems to occur easily when Windows is resumed.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@prlabeler prlabeler bot added the bug Something isn't working label Oct 29, 2025
@github-actions github-actions bot added this to the 2.1.0 milestone Oct 29, 2025
Copilot AI changed the title [WIP] Fix Flow Launcher indexing issue when shortcut is spammed Fix program indexing failure when shortcut key is spammed during startup Oct 29, 2025
Copilot AI requested a review from Jack251970 October 29, 2025 05:10
Copilot finished work on behalf of Jack251970 October 29, 2025 05:10
@Jack251970 Jack251970 removed this from the 2.1.0 milestone Oct 29, 2025
@Jack251970 Jack251970 removed their assignment Oct 29, 2025
@Jack251970 Jack251970 removed their request for review October 29, 2025 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10 min review bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Flow Launcher doesn't finish indexing programs if spammed the shortcut key to launch it while it's starting

2 participants