Repository navigation
test(deliveries): worker tests await their attempts and idle polls instead of polling and sleeping - #697
Open
PiquelChips wants to merge 1 commit into
Open
test(deliveries): worker tests await their attempts and idle polls instead of polling and sleeping#697PiquelChips wants to merge 1 commit into
PiquelChips wants to merge 1 commit into
Conversation
…stead of polling and sleeping
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
PiquelChips
marked this pull request as ready for review
November 22, 2026 14:55
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.
Delivery worker tests found out what the workers had done by listing the database every 50ms. One of them also slept two full poll intervals (2s) so that an idle poll would happen. They now await what the workers report as it happens, which also makes them faster.
Independent of the other PRs in this series; based on
main.Changes
Sendergets a#[cfg(test)] fn idle(&self) {}hook. A worker calls it whenever its poll finds nothing due. It does not exist outside tests.Recorderpublishes aSeen { attempts, idle }in awatch: each attempt's delivery ID as its send starts, and a count of idle polls.wait_fornow awaits thatwatchinstead of listing the database. Once it returns, the test shuts the workers down, which finishes any attempt in progress and records its outcome. Then the test reads the delivery once withlistedand asserts as before.Tests
workers_retry_retryable_errors_and_fail_permanent_ones: waits for both deliveries' attempts, shuts down, then asserts the same statuses, errors, backoff and attempt IDs.each_attempt_is_a_trace_and_idle_polls_export_nothing: waits for the attempt and then for an idle poll after it, instead of sleeping two intervals. It now also checks that the delivery failed. Checked: with the worker loop running inside a span, which makes idle polls export, the test fails.a_resent_delivery_carries_the_same_id: the first replica sends, is shut down, and the delivery reads as failed. After the operator retries, a second replica sends it again. The test asserts the same two attempts with one ID, and success.a_delivery_survives_its_replica_dying_mid_send: waits for B's send, then shuts B down, which records its success, before releasing A. So A's late refusal still arrives after B's success, as before, and must be discarded. The test asserts the same lease, ID and outcome.I ran the 4 tests five times against a scratch cluster, and they passed every time.
Council review
Rounds: 2
GPT 6.1 Sol could not take part: its account hit its usage limit.
Note
Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus 5.5 and Claude Fable 5.2 (via T3 Code)