-
-
Notifications
You must be signed in to change notification settings - Fork 291
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
Improves wait_exponential_jitter #426
base: main
Are you sure you want to change the base?
Conversation
Is there anything blocking this from being merged? Deprecation concerns? It's been almost 1 year. |
Hi @yxtay ,
The correct thing to do is to leave the implementation of |
result = self.max | ||
return max(0, min(result, self.max)) | ||
result = super().__call__(retry_state) + random.uniform(0, self.jitter) | ||
return max(self.min, min(result, self.max)) |
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.
the min part should be equal to max(0, self.min)
(in case self.min is negative + follow same formula as wait_exponential)
Summary
Improves wait_exponential_jitter to inherit wait_exponential
- Reuses
wait_exponential.__call__
method instead of of duplicating code- Follows argument names of wait_exponential
- Adds
min
argument- Supports supplying
max
,jitter
,min
arguments astimedelta
Tests