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
ExponentialBackOff doesn't exit after MaxElapsedTime
is passed
#120
Comments
UPDATE: so it turns out the issue is not setting |
I don't remember why it is exported in the first place. You should use |
hey, I just got the same issue. The problem is that the code won't work with retry as retry looks specifically for backoff.Stop
Will not work, if you want this to work you need
but this won't work without changing the interface as Backoff doesn't have a custom Stop value in it, only ExponentialBackoff. So regardless of the reason for allowing overriding the Stop, it is currently broken as is. |
@hamstah You should use the construct for creating new |
@cenkalti sounds like a builder would be beneficial in this case. I just took this library up today and the options are pretty confusing. It's either use the default value or good luck. I would suggest a builder starting with default values with validations on |
That isn't true, though. Nothing prevents users from modifying configurations created by constructors, and modifying structs by their users seems somewhat common in the Go ecosystem. I used this library first time yesterday, and had a positive experience even though I needed to set a few non-default values. Even though I found it easiest to understand the customisation options through reading code. |
@svkoskin I was able to figure out the library very quickly as well by reading the internals. But mistakes such as the one OP posted could be very common. Internals of your struct that aren't meant to be modified should be obscured from the end user, i.e. the Yeah modifying structs can be common but you can also set private fields by lower casing the field name, which would prevent unintended issues. |
Try out the following test:
It will timeout. Nothing immediately seems wrong to me with the way the BackOff is configured. Why does this happen?
The text was updated successfully, but these errors were encountered: