Skip to content

OnRetry terminology is ambiguous #31

@clook

Description

@clook

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions