-
Notifications
You must be signed in to change notification settings - Fork 387
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
fix(core): Proper retry count in KazooRetry #748
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #748 +/- ##
==========================================
- Coverage 97.01% 96.67% -0.34%
==========================================
Files 27 27
Lines 3549 3553 +4
==========================================
- Hits 3443 3435 -8
- Misses 106 118 +12 ☔ View full report in Codecov by Sentry. |
@@ -133,10 +133,10 @@ def __call__(self, func, *args, **kwargs): | |||
except ConnectionClosedError: | |||
raise | |||
except self.retry_exceptions: | |||
self._attempts += 1 | |||
# Note: max_tries == -1 means infinite tries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you see a way to test this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what you mean: what 'case'?
Do you mean that it on catches the exception if it is in the self.retry_exceptions
set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of the note Note: max_tries == -1 means infinite tries.
Make sure the number of attempts matches the `max_retry` parameter. Add unit tests to that effect.
Make sure the number of attempts matches the
max_retry
parameter. Add unit tests to that effect.Why is this needed?
So that users can precisely control the number of retries
Proposed Changes
max_try
so we don't end up callingmax_tries + 1
times the function.Does this PR introduce any breaking change?
No, it shouldn't.