Skip to content

Conversation

StounhandJ
Copy link

This MR fixes a logic issue where AttemptsForError was ignored when the global Attempts value was set to 0. Since version 4.3.0, the retry library introduced AttemptsForError to allow fine-grained retry limits per error type. However, this mechanism was silently bypassed if retry.Attempts(0) was set, causing unexpected behavior and making debugging difficult.

Additionally, the logic for calling Is Recoverable was moved into the main retry loop to ensure it is properly respected for all configured attempts and error types.

Changes:

Apply AttemptsForError even if retry.Attempts(0) is used

Move IsRecoverable logic into the core retry loop to ensure it is evaluated consistently

Backward Compatibility:
This change makes retry behavior more consistent and does not break existing configurations unless users relied on the undocumented behavior of Attempts(0) disabling all retry logic.

tstromberg added a commit to codeGROOVE-dev/retry that referenced this pull request Jul 28, 2025
tstromberg added a commit to codeGROOVE-dev/retry that referenced this pull request Jul 28, 2025
merge:  Fix: Check Attempts For Error even when Attempts is zero avast#131
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant