-
Notifications
You must be signed in to change notification settings - Fork 336
Refactored retry config into _retry.py
and added support for exponential backoff and Retry-After
header
#871
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
Conversation
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.
Thanks Jonathan! Overall looking good! Added a few comments!
firebase_admin/_retry.py
Outdated
|
||
def __init__( | ||
self, | ||
status: int = 10, |
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.
Would it make sense to call this max_retries
instead?
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.
In the current state yes because status retries are our only retries we have. This was more of a future proof decision for when we added error retires where we would have total, status and error counters.
Similar to the placeholder comment I think we can use max_retries
(and retries_left
internally since we decrease this value) and add the other options later.
response, error = None, None | ||
|
||
try: | ||
logger.debug('Sending request in _dispatch_with_retry(): %r', request) |
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 we plan to keep these logs in the production code?
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 would want to keep these for future debugging. This would be helpful to catch issues as we iterate. Wdyt?
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.
LGTM! Thank you!
Adds more retry logic support
This PR covers:
HttpxRetryTransport
to_retry.py
HttpxRetry
to manage retry stateHttpxRetryTransport
creationRetry-After
headers from request responsesHttpxRetry
andHttpxRetryTransport