-
Notifications
You must be signed in to change notification settings - Fork 29
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
NewConstant
panics if the given base is zero
#9
Comments
Hey @Deleplace - I'm really hesitant to do that because it creates a hot loop. The default behavior (without middleware) is to retry indefinitely. Thus |
Right, busy loops are not great. The use cases I had in mind (network requests, DB requests, filesystem I/O) are so slow that they are self-throttled even without a delay between two attempts. Now I realize that some use cases may indeed hog CPU/memory: whenever a resource is "not ready" and this information is in memory. E.g. "no network for now". So, a zero backoff delay would be safe only when combined with flavors of |
Even then, I think having a base like 10*time.Nanosecond is a good best practice. |
This issue is stale because it has been open for 14 days with no |
This issue has been automatically locked since there has not been any |
It seems to me that a zero
Backoff
makes sense, from a user POV who would just want to enjoy a retry facility.Can we make
0
an accepted value forNewConstant
?Of course it is not difficult for a user to just call
NewConstant(time.Nanosecond)
, but for flexibility I'm not sure we should advertise "zero delay" as a forbidden parameter.Zero delays may already occur when using the API, as discussed in #8.
The text was updated successfully, but these errors were encountered: