Repository navigation
test(locallibrary): cancel a publish only once its upload is being sent - #278
Merged
Merged
Conversation
The test cancelled on a 300 ms timer, which under load fired before the host had sent the request. Nothing was sent, the server waited in accept forever, and "the upload stopped" failed after 10 s. The server now cancels once it has received the first bytes.
bnb
approved these changes
Oct 29, 2026
Rust coverageFrom run 525. Both are held to the thresholds in .cargo/config.toml.
|
1 task done
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 and why
plugins::destinations::a_recording_stops_being_sent_once_publishing_is_cancelledfailed now and then on macOS CI, waiting 10 s for "the upload stopped" (main, 10-26, #268). It cancelled publishing on a 300 ms timer, and under load that timer can go off before the host has sent the request. Then nothing is uploaded, the test's server waits inaccept()forever, and the wait times out. Setting the timer to 0 ms reproduces it every time, with the same 10.7 s failure.The test now creates the cancel token before its server thread, and the server cancels once it has received the first bytes of the recording, so the cancel always lands on an upload that's being sent. The 300 ms timer thread is gone. Every assertion is unchanged: publishing answers
cancelled, the server sees the upload end, less than half the recording was sent, and the set has no link. No library code changes. In every passing run before this change, the host's body reader stopped on the cancel and the server saw the connection close.How it was tested
Stress runs of the one test with
cargo nextest run -p locallibrary --test it -E 'test(a_recording_stops_being_sent_once_publishing_is_cancelled)' --stress-count N:cargo fmt --all --checkpasses, andcargo nextest run -p locallibrarypasses 2125/2125.Checklist
apps/locallibrary/CHANGELOG.mdhas a line under Unreleased, if people using it will noticedocs/and--helpstill say what the code does (apps/locallibrary/docs/rpc/too, for a sidecar change)