Repository navigation
test(rpc): wait for the request to be read in race() - #108
Merged
Merged
Conversation
…ace() On a slow runner the daemon could parse the bot's text before it took the request off the socket, so the text legitimately went out first. Wait 200 ms after sending, well under the 1 s the store is held.
With the store held, the runtime's timer did not fire until the hold ended, so the 200 ms tokio sleep lasted the whole second and the text then raced the files.list answer (Rust (Ubuntu) on #108). A thread sleep does not depend on that timer.
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.
race()incrates/botloftd/tests/rpc_queue.rssent the request and had the lead bot write text right away. On the slow macOS runner (run 37015740012 on #107) the daemon parsed the bot's output before it read the request off the socket, soan_answer_goes_out_before_the_notifications_after_itgot["text", "answer"].The test now waits 200 ms after
send_raw, well under the 1 s the store is held.rpc/has no hook that shows when a request is queued (an in-order request just blocks on the store's mutex inspawn_blocking), so a short wait is the least intrusive fix. What each test checks is unchanged:a_slow_read_holds_back_no_notificationstill expects the text before thefiles.listanswer.The wait is a
std::thread::sleep, nottokio::time::sleep. With the store held, the runtime's timer did not fire until the hold ended, so a tokio sleep lasted the whole second and the text then raced thefiles.listanswer. That made the aside test fail on Ubuntu in the first CI run. Timestamps confirmed it locally: the 200 ms sleep took about 1000 ms.cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings: passcargo test -p botloftd --test rpc_queue: 10 runs in a row passmainfailed 0 of 60.No real-Claude check needed: test-only change.