-
Notifications
You must be signed in to change notification settings - Fork 160
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
OnRetry terminology is ambiguous #31
Comments
Hi @clook |
thanks @JaSei |
Sorry @clook, I don't understand well what's wrong? thanks |
Hi @JaSei, Thanks for coming back.
I expect a single try to fail (and no "retry"), so no call to Regarding the test here: https://github.com/avast/retry-go/blob/master/retry_test.go#L34 A more helpful test to double check the number of
and
which I think would fail with the current implementation. Tell me if it makes things clearer. |
Hello @JaSei , Here is a minimal example as requested.
Which outputs:
As you can see with the output, we fall in the |
Hi and first thanks for this useful contribution for go 🙏
From the
OnRetry
terminology, I expectOnRetry
to happen between an failed try and the subsequent try. I would not expect it to happen just after the last try.I would expect the current behavior from a function
OnFailure
orOnTryFailure
(to distinguish from a failure), and I'm by the way basing onretry.Do
return to know if the operation has not succeeded finally (ie exceeded).I would understand if you want to keep the existing behavior to avoid breaking changes but I would at least add a boolean parameter like
lastTry
orExceeded
to be able to distinguish if a next try is really going to happen.Without it, we have to use a wrapper or implement this behavior in our calling code, which should be agnostic to the "retry business" to my mind.
I may provide a PR for any of the suggested changes.
Thanks in advance!
The text was updated successfully, but these errors were encountered: