-
Notifications
You must be signed in to change notification settings - Fork 172
Description
Hi and first thanks for this useful contribution for go 🙏
From the OnRetry terminology, I expect OnRetry 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 or OnTryFailure (to distinguish from a failure), and I'm by the way basing on retry.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 or Exceeded 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!