-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eager retry for short retry delays (#105)
An aspect of River that could currently be considered a bug is that retry delays below five seconds are effectively ignored. This is because when a job errors it always transitions to `retryable` state, and needs to wait for the scheduler to run to transition it back to `available`, and the scheduler run interval is five seconds. This is in practice a problem because it means that the first retry in a retry policy isn't actually one second as claimed in docs, etc., but actually ~5 seconds, and it won't be obvious why. Here, implement an "eager" retry system such that if we detect that the retry delay is smaller than the scheduler's run interval, we place the job immediately into an `available` state, allowing it to be worked sooner. To facilitate this we add a predicate on the "get available" query that checks for `scheduled_at <= now()` so that errored jobs with short retries can be `available` for a short time without being worked immediately. Most of the time this should have no effect because this really only applies to the first retry in any failure (the second is at 16 seconds, which is well above the scheduler's run interval).
- Loading branch information
Showing
13 changed files
with
228 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.