Repository navigation
fix(server): do not hold the store lock across the capture extractor call - #1674
Merged
Merged
Conversation
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
uteke-core(capture.rs):claim_capture_batch(claim and read the turns),extract_batch(every chunk, no store access) andfinish_capture_batch(withdraw leftovers, store the facts, mark done or release).capture_housekeepingandcapture_pending_sessionsare the run's start.run_capture_extractionis now these steps in order, souteke extract-queue runis unchanged in behaviour.uteke-serve'srun_cycletakes theMutex<Uteke>only for the claim and for the finish, and releases it for the extractor call.run_cyclechecksshutdownbetween sessions.capture:<session>:<batch>source semantics are unchanged, and the capture routes are LAB, so no contract change.Why
run_cycleheld the lock whilefacts.extract()made a blocking HTTP request of up to 120 s per chunk, so one slow provider call stalled every recall, remember and viewer request, and a hung provider did so on every scheduled run.Testing
the_store_lock_is_free_while_the_extractor_runs: a fakeFactSourcesleeps 1.5 s; asearchon the sameMutexcompletes within 800 ms while the cycle is still running.a_failure_between_claim_and_store_leaves_the_batch_recoverable(server): an extractor error requeues the batch; an extractor panic after the claim leaves the lock unpoisoned and the batchextracting, and it is reclaimed and extracted after the lease.a_batch_abandoned_between_claim_and_store_is_claimed_again_as_the_same_batch(same source),an_extractor_failure_between_claim_and_store_releases_the_batch.a_shutdown_stops_the_cycle_between_sessions,a_session_the_provider_refuses_is_tried_once_per_cycle.cargo test --workspace,cargo clippy --workspace --all-targets -- -D warnings.Closes #1663