Write faulted objects off the async worker - #45
Open
0bserver07 wants to merge 1 commit into
Open
Conversation
The web object faulter read objects from a remote pack set asynchronously and then called `write_loose_object` for each of them on the same tokio worker, so one request for a commit diff could spend seconds stating paths, deflating and renaming files while it held a runtime thread. `fault_many` now collects the reads of each chunk of 32 and hands the whole chunk to one `tokio::task::spawn_blocking`, and `fault` writes its single object through the same helper. Behaviour is unchanged: the same objects land in the loose store, ids already faulted are still skipped, and the error text is still `fault object <oid>: <e>`, with a join failure reported as an internal error. AGENTS.md principle VI says never block the async runtime, and `spawn_blocking` is the pattern the rest of the crate already uses. Checked with `cargo clippy -p walgit-server --all-targets --no-deps` (clean apart from the pre-existing `rebuild.rs:141` cast lint), the `web_api`, `web_ui` and `api_v1` suites, `cargo test -p walgit-server --test e2e -- remote`, the e2e `blocking_work_in_the_install_path_does_not_stall_requests`, and `cargo fmt --all -- --check`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CSbhRh6UEjFrgBYYzucvDe
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.
crates/walgit-server/src/web/objects.rsread objects from the remote pack set asynchronously and then wrote them to the loose store on the same tokio worker:fault_manycalledwrite_localfor every object after itsjoin_all, andfaultdid the same for one.write_localgoes toLocalRepo::write_loose_object, which stats a path, deflates the object and creates and renames a file, so a commit diff of up toMAX_DIFF_OBJECTSobjects could hold a runtime thread for seconds on a remotely served monorepo. Principle VI again.fault_manynow collects each chunk of 32 reads and hands the batch to onetokio::task::spawn_blockingthat does the writes, andfaultgoes through the same helper. Same objects written, already faulted ids still skipped, same error text, a join failure becomes an internal error;MAX_DIFF_OBJECTS, the read side and the loose store in walgit-git are untouched. One difference on the failure path only: a read error partway through a chunk now returns before that chunk's earlier objects are written, which only affects a cache.Checked with
cargo clippy -p walgit-server --all-targets --no-deps -- -D warnings,cargo test -p walgit-server --test web_api --test web_ui --test api_v1(the remote-objects conformance test lives inweb_api), the e2eremotetests andblocking_work_in_the_install_path_does_not_stall_requests, andcargo fmt --all -- --check.