-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
decrement attempt on snooze, unaltered max_attempts
When snoozing was implemented, we needed to ensure that snoozes didn't count against a job's attempts so that it could keep snoozing repeatedly if desired. The design chosen for this was to increment `max_attempts` since `attempt` is automatically incremented when a job is fetched. This choice turns out to have some downsides: * It leads to situations where `max_attempts` could accidentally overflow the `smallint` range, even if the job wasn't erroring and was just meant to snooze indefinitely. * The implementation of a `RetryPolicy` is a little trickier because one can't merely rely on the `attempt` since it gets inflated by snoozes. Instead, you'd need to use `len(job.errors)` to determine retry backoffs. To resolve both these situations, change the implementation so that snoozing causes `attempt` to be _decremented_ rather than _incrementing_ `max_attempts`. In order to make this easier to detect, set a `snoozes` attribute in the job's metadata and increment it each time a snooze occurs. The implementation of the builtin `RetryPolicy` implementations is not changed, so this change should not cause any user-facing breakage unless somebody is relying on `attempt - len(errors)` for some reason. Fixes #720.
- Loading branch information
Showing
16 changed files
with
324 additions
and
210 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
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.