Skip to content
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

retrypolicy: fix '-1' logic for WithMaxAttempts => maxRetries #32

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

srenatus
Copy link
Contributor

Before, setting WithMaxAttempts(-1) led to maxRetries = -2, and this check would always trigger:

maxRetriesExceeded := rpe.config.maxRetries != -1 && rpe.failedAttempts > rpe.config.maxRetries

As a result, no retry attempts would be made.

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 52.52%. Comparing base (3be8274) to head (d7f5779).

Files Patch % Lines
retrypolicy/retry.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #32      +/-   ##
==========================================
- Coverage   52.67%   52.52%   -0.15%     
==========================================
  Files          19       19              
  Lines        1403     1407       +4     
==========================================
  Hits          739      739              
- Misses        648      652       +4     
  Partials       16       16              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jhalterman
Copy link
Collaborator

jhalterman commented Feb 29, 2024

Apologies for the conflict. If you can rebase c5bf7dc again off of main, I can merge.

Signed-off-by: Stephan Renatus <stephan@styra.com>
@srenatus
Copy link
Contributor Author

Ok it's fixed. I'm a little surprised that you saw a reason to force-push the main branch, to be frank 😅

@jhalterman
Copy link
Collaborator

Yea, fair point. Once a repo starts to get collaborators, it's better to just revert a commit 😄

Thanks for the PR!

@jhalterman jhalterman merged commit 754e0a7 into failsafe-go:main Feb 29, 2024
2 checks passed
@srenatus srenatus deleted the sr/fix-max-attempts branch February 29, 2024 16:45
@jhalterman
Copy link
Collaborator

This was released in 0.6.0 along with http support.

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.

None yet

2 participants