Skip to content

Conversation

@katafrakt
Copy link
Contributor

The checkpoint file can be quite large (1.2G in my case) and it may take quite a while to load it (8.2s in my case). During that time, all the GenServer calls with the default timeout of 5000ms might timeout, leading to the whole GenServer termination and general instability of the search functionality.

This adds guards for state.loaded? which return {:error, :loading} if it's not loaded.

This addresses #303, probably only partially. I have more suspects of taking too long on a large project:

  • query_by_subject during delete (as described in Timeouts on querying search store #303)
  • reduce takes 2-3 seconds for my project
  • apply large WAL file - I once saw it grow to 17M, but I didn't manage to measure how long does it take to apply it

The checkpoint file can be quite large (1.2G in my case) and it may take
quite a while to load it (8.2s in my case). During that time, all the
GenServer calls with the default timeout of 5000ms might timeout,
leading to the whole GenServer termination and general instability of
the search functionality.

This adds guards for state.loaded? which return {:error, :loading} if
it's not loaded.
@mhanberg
Copy link
Member

What is the result of adding these error return values?

Does the editor display an error message?

@katafrakt
Copy link
Contributor Author

@mhanberg it is handled by the caller, like for example here:

    case Store.exact(subject, condition) do
      {:ok, entries} ->
        entries

      _ ->
        []
    end

One thing that could maybe be improved is to handle it inside call_or_default, but I'm not sure. What do you think?

Either way, it's not visible to the editor. Client just gets an empty result set (and rightly so, I think, it's not an error - search index is simply not available at the moment).

@mhanberg
Copy link
Member

Gotcha, I think it could be worth to keep the behavior as you have it but also post a window/showMessage notification that says the index is still loading.

Or else to the user they think it's just not working.

@katafrakt
Copy link
Contributor Author

Added. Works in my tests.
Screenshot 2026-01-16 at 18 49 59

@katafrakt katafrakt force-pushed the short-circuit-during-loading branch from 48e1882 to 7cc91da Compare January 16, 2026 18:00
@mhanberg mhanberg merged commit 438c965 into elixir-lang:main Jan 18, 2026
37 checks passed
@mhanberg
Copy link
Member

It might also be good to emit a progress notification when loading the search thing

@katafrakt katafrakt deleted the short-circuit-during-loading branch January 18, 2026 14:27
doorgan pushed a commit that referenced this pull request Jan 19, 2026
This implements the idea from #308 to add progress notification while
the ets checkpoint is loading.

<img width="905" height="484" alt="Screenshot 2026-01-19 at 11 03 29"
src="https://github.com/user-attachments/assets/0955e29d-0bc7-4ca4-9c6e-2f70efe14f96"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants