Add maxbackoff and backoffincrement options#1626
Open
cdelguercio wants to merge 6 commits intoSupervisor:mainfrom
Open
Add maxbackoff and backoffincrement options#1626cdelguercio wants to merge 6 commits intoSupervisor:mainfrom
cdelguercio wants to merge 6 commits intoSupervisor:mainfrom
Conversation
* maxbackoff - the maximum number of seconds that supervisor will backoff before restart * backoffincrement - the number of seconds to add to the backoff after each retry
Author
|
If maxbackoff and backoffincrement are both set, adding backoffincrement to backoff may result in the remaining retries having a backoff value higher than maxbackoff. Ex: backoff will go from |
warrenspence
reviewed
Aug 8, 2024
| now = time.time() | ||
| self.backoff += 1 | ||
| if self.backoff < self.config.maxbackoff or self.config.maxbackoff == 0: | ||
| self.backoff += self.config.backoffincrement |
There was a problem hiding this comment.
@cdelguercio to prevent the issue you mentioned in #1626 (comment) you can use min:
self.backoff = min(self.backoff + self.config.backoffincrement, self.config.maxbackoff)
Author
There was a problem hiding this comment.
I think you'd have to do something like:
self.backoff = self.config.maxbackoff == 0 ? self.backoff + self.config.backoffincrement : min(self.backoff + self.config.backoffincrement, self.config.maxbackoff);
The question is: what's preferred?
There was a problem hiding this comment.
Yeah I see what you are saying, I missed the self.config.maxbackoff == 0 case.
What you have suggested looks correct 👍
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.
maxbackoff - the maximum number of seconds that supervisor will backoff before restart
backoffincrement - the number of seconds to add to the backoff after each retry
based on #1529
Fixes #323