-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
retry: Default MaxBackoff is unintuitive #140
Comments
@ryanmcnamara I don't quite follow the problem above. Maybe you have a typo here? Could you clarify what you would have expected to happen with the code snippet above? |
Fixed my typo |
Cool, maybe a "fix" for this is instead of making MaxBackoff 0, we set it to the initial backoff value if that is configured? |
Yes, although this is working as documented, agree that it's unintuitive given the starting parameters. If the default value isn't a concrete value, I feel like @ashrayjain if |
Cool, "0" works then. I really think we should make sure nobody gets burned by this change though. Can we excavate all places that use retry.Do currently without setting a MaxBackoff and explicitly add a MaxBackoff(2) in those places to preserve behavior? |
Yeah it's hard to say for sure because Mateusz isn't around, but I believe the intent of the default value for max backoff is that most "simple" calls probably don't want to back off for more than 2 seconds at the upper bound. However, this is obviously completely subjective, and does result in very confusing behavior when the initial back-off is set to be above the max. It sounds like the basic possible paths are:
|
I would much prefer making the break to the api (first option @nmiyake suggested above). I'm not that worried about excavating the changes, because I believe that all usages of this that don't explicitly set MaxBackoff intended for it to be zero (no limit). |
I think adding a release note and letting consumers audit their own code base on upgrade is sufficient |
my vote is for approach 3 which is the cleanest and imo, the "right" way to handle this. We can choose to deprecate v1 and remove it entirely after some time if we'd like. or we can make it a compile break to force people to explicitly pick a value somehow. @ryanmcnamara |
@willdeuschle submitted #186 before either of us saw this ticket. Would folks be ok with that change (using initialBackoff as the max if it's larger than maxBackoff)? |
Issue
I would expect the following
To output one log line every 10 seconds. However what this actually outputs is
The reason for this output is the default for MaxBackoff is as follows:
While the documentation is good, this caused us to write bugs that affected us in production as I think it's unintuitive.
Proposal
Set the default value of max backoff to 0 instead of 2 seconds, so that the max backoff will be unlimited.
I realize this is a breaking change, but I would believe that most people using this library would expect it to work this way
The text was updated successfully, but these errors were encountered: