feat(engine): increase build timeout duration, add batch uri reindex with debounce#698
feat(engine): increase build timeout duration, add batch uri reindex with debounce#698lsdrfrx wants to merge 3 commits into
Conversation
doorgan
left a comment
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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}) |
There was a problem hiding this comment.
Can we add some tests that set a non-zero debounce interval, and check that the debounce is working? 100 or 500ms should work
| Enum.each(state.pending_uris, fn uri -> | ||
| case entries_for_uri(uri) do | ||
| {:ok, path, entries} -> | ||
| Search.Store.update(path, entries) |
There was a problem hiding this comment.
Probably cleaner as a comprehension (not tested)
| 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 |
|
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? |
|
@lsdrfrx yes you can run |
Increased
Engine.Buildcompilation timeout from 50ms to 1000ms (do not know which value will fit)Slightly reworked
Engine.Commands.Reindex: now reindex adds URIs intopending_urisMapSet and process them after 1000ms debounceCloses #672