Skip to content

Conversation

cdelguercio
Copy link

@cdelguercio cdelguercio commented Feb 28, 2024

  • 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

@cdelguercio
Copy link
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:
maxbackoff = 25
backoffincrement = 10

backoff will go from
1, 11, 21, 31, 31, 31, 31...

now = time.time()
self.backoff += 1
if self.backoff < self.config.maxbackoff or self.config.maxbackoff == 0:
self.backoff += self.config.backoffincrement

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I see what you are saying, I missed the self.config.maxbackoff == 0 case.

What you have suggested looks correct 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

RFE: Ability to specify delay time, algorithm within supervisor

2 participants