Fix intermittently failing test Test_Client_JobCompletion/JobThatReturnsErrIsRetryable#1247
Merged
Merged
Conversation
…urnsErrIsRetryable` Here, try to address an intermittently failing test seen in CI [1]. The problem seems to be that although the test case stubs the current time with `StubNow`, it's possible for the producer's fetch loop to be running concurrently and call `NowOrNil()` before the stub takes effect, causing a divergence from the stubbed time by a few milliseconds. The fix here drops the use of stubbed now, and instead asserts that the new `ScheduledAt` is `AttemptedAt` plus the expected retry interval, using a value from a reloaded job row to guarantee we don't have a race. We drop the use of time stubbing completely as this approach no longer requires it. [1] https://github.com/riverqueue/river/actions/runs/25657083352/job/75308035231
Contributor
Author
|
Damn, fix for intermittently failing test reveals another intermittently failing test. |
Contributor
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
bgentry
approved these changes
May 11, 2026
Contributor
bgentry
left a comment
There was a problem hiding this comment.
Much better to not have to care about stubbing time 🙌
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.
Here, try to address an intermittently failing test seen in CI [1].
The problem seems to be that although the test case stubs the current
time with
StubNow, it's possible for the producer's fetch loop to berunning concurrently and call
NowOrNil()before the stub takes effect,causing a divergence from the stubbed time by a few milliseconds.
The fix here drops the use of stubbed now, and instead asserts that the
new
ScheduledAtisAttemptedAtplus the expected retry interval,using a value from a reloaded job row to guarantee we don't have a race.
We drop the use of time stubbing completely as this approach no longer
requires it.
[1] https://github.com/riverqueue/river/actions/runs/25657083352/job/75308035231