-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
calculate retries based off current time, not job start time
In a demo app, I was seeing a bunch of errors with this message: > Retry policy returned invalid next retry before current time; using > default retry policy instead The only problem is, I _was_ using the default retry policy for this worker and client. These log lines manifested because the `DefaultClientRetryPolicy` is calculating the next attempt based on: job.AttemptedAt + backoffDuration This isn't really noticeable if the job is super quick, but if like my demo app your job is taking 10s of seconds or longer, the next attempt could actually be scheduled for far in the past instead of in the future, making it run again immediately instead of after the backoff duration. This commit changes the behavior to only look at the current time (`time.Now().UTC()`) when determining when the next attempt should be, without regard to when the last attempt began.
- Loading branch information
Showing
4 changed files
with
22 additions
and
6 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