Skip to content

feat(engine): increase build timeout duration, add batch uri reindex with debounce#698

Open
lsdrfrx wants to merge 3 commits into
expert-lsp:mainfrom
lsdrfrx:debounce-compilation
Open

feat(engine): increase build timeout duration, add batch uri reindex with debounce#698
lsdrfrx wants to merge 3 commits into
expert-lsp:mainfrom
lsdrfrx:debounce-compilation

Conversation

@lsdrfrx
Copy link
Copy Markdown

@lsdrfrx lsdrfrx commented May 28, 2026

  • Increased Engine.Build compilation timeout from 50ms to 1000ms (do not know which value will fit)

  • Slightly reworked Engine.Commands.Reindex: now reindex adds URIs into pending_uris MapSet and process them after 1000ms debounce

Closes #672

Copy link
Copy Markdown
Contributor

@doorgan doorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I left you some comments, there's also some failing tests that need fixing


state
timer =
Process.send_after(self(), :flush_pending, state.debounce_interval_millis)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message should be {:flush_pending, timer_ref}, where timer_ref is created with make_ref/0 and should be stored in the server state, then matched against in handle_info
Otherwise, if this timer becomes stale due to a new reindex running, it won't make this run while there is another reindex running

end

start_supervised!({Reindex, reindex_fun: reindex_fun})
start_supervised!({Reindex, reindex_fun: reindex_fun, debounce_interval_millis: 0})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some tests that set a non-zero debounce interval, and check that the debounce is working? 100 or 500ms should work

Comment on lines +62 to +65
Enum.each(state.pending_uris, fn uri ->
case entries_for_uri(uri) do
{:ok, path, entries} ->
Search.Store.update(path, entries)
Copy link
Copy Markdown
Contributor

@doorgan doorgan Jun 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably cleaner as a comprehension (not tested)

Suggested change
Enum.each(state.pending_uris, fn uri ->
case entries_for_uri(uri) do
{:ok, path, entries} ->
Search.Store.update(path, entries)
for uri <- state.pending_uris,
{:ok, path, entries} <- entries_for_uri(uri) do
Search.Store.update(path, entries)
end

@lsdrfrx
Copy link
Copy Markdown
Author

lsdrfrx commented Jun 1, 2026

Thanks for the feedback! I’ll push the fixes shortly.

Is it possible to run all tests locally, so I could be sure that CI passes?

@doorgan
Copy link
Copy Markdown
Contributor

doorgan commented Jun 1, 2026

@lsdrfrx yes you can run just test to run all tests, or just test engine, just test expert to run tests for a specific app
You need https://github.com/casey/just to run those

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debounce project compilation

2 participants