Repository navigation
Stop a release wait at its last look, however little the clock moved - #88
Merged
Merged
Conversation
With no wait, the loop's last look was `elapsed + every > wait`: 0 > 0 when the clock had not moved since the wait began, so it asked GitHub again, and on a clock that does not move at all it never stopped. A coarse monotonic clock on a loaded Mac made the test see 4 requests instead of 2. The last look is now the one after which the next would come at the end of the wait or past it (>=), and the wait reads an injected Monotonic clock, so the tests run it on a frozen or stepped clock.
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.
a_commit_with_no_release_is_refused_and_one_that_comes_out_while_it_waits_is_takenfailed every time on a loaded Mac and passed on CI. The cause is inReleaseUpdate::release_of, not the test.Cause
The last look was decided by
began.elapsed() + every > wait. With a zero wait (the bench's default), that is0 > 0whenever the monotonic clock has not moved betweenInstant::now()andelapsed(), which a coarse or busy clock allows. The loop then looked a second time (4 GitHub requests instead of 2). On a clock that does not move at all it never stopped asking.Fix
>=. A zero wait asks once. In production (45 min, every 3 min) the waits end after 15 looks instead of 16, the last at 42 min.release_ofreads an injectedcf_ghapp::Monotonicclock (the trait the token source already uses),SystemMonotonicin production.TestClock, frozen by default and stepped where a test needs time to pass. It fails after 10,000 reads, so a wait that never ends fails instead of hanging CI.a_wait_reads_the_newest_releases_only_now_and_thennow asserts exactly 14 looks (40 ms steps, 600 ms wait) instead of>= 10, which pins the boundary.Evidence
cargo test -p codefusion-runner -j2 <name> -- --test-threads=2). All 16release_updatetests pass.>back makes the 14-looks assertion fail (15 looks).cargo fmt --checkandcargo clippy --all-targets -D warningson the crate are clean.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.