Clarify docstring for Retry backoff factor #3037
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Changes
This PR makes two changes to the docs for Retry's
backoff_factor
:total
argument provided to a Retry instance- 1
from the end of the formula1 * (2 ** (1 - 1))
or 1 second1 * (2 ** (2 - 1))
or 2 secondsValidating this Change
To validate that the updated formula is correct, run this in one process:
And this in another process:
This script will make requests to the webserver with a backoff factor of 1 and you can note the interval between each retry.
Conclusion
All in all, I think making these two changes will clarify how the backoff factor works and how long it will wait between retries.
Please let me know if you have any questions or suggestions!