-
Notifications
You must be signed in to change notification settings - Fork 309
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
feat: Retry behavior #1113
feat: Retry behavior #1113
Conversation
3f634f6
to
3593bab
Compare
3593bab
to
185349c
Compare
185349c
to
9229690
Compare
9229690
to
100dd2f
Compare
100dd2f
to
b2c3315
Compare
b2c3315
to
80d90ed
Compare
@parthea do you mind reviewing this for Python readability? |
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.
couple more questions on default retryables.
google/oauth2/_client_async.py
Outdated
|
||
try: | ||
access_token = response_data["access_token"] | ||
except KeyError as caught_exc: | ||
new_exc = exceptions.RefreshError("No access token in response.", response_data) | ||
new_exc = exceptions.RefreshError( | ||
"No access token in response.", response_data, retryable=True |
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.
why this is by default Retryable?
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.
if it is expected why we expect the retry to succeed?
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.
My interpretation was that should this happen we have received a malformed request or error, that ideally should have been handled at the transport layer.
I think the best path is to retry it to see if that resolves the issue.
If you disagree I am happy to set this to False
. It is hard to decide what is right :)
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.
Let's have them as false since that is the original behavior
We don't want to retry those because - it is not a valid case, we don't expect it often enough to retry just in case
google/oauth2/_client_async.py
Outdated
|
||
try: | ||
id_token = response_data["id_token"] | ||
except KeyError as caught_exc: | ||
new_exc = exceptions.RefreshError("No ID token in response.", response_data) | ||
new_exc = exceptions.RefreshError( | ||
"No ID token in response.", response_data, retryable=True |
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.
same question on a default retryable
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.
like above, lets switch to false
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, thanks!
* feat: Retry behavior * Introduce `retryable` property to auth library exceptions. This can be used to determine if an exception should be retried. * Introduce `should_retry` parameter to token endpoints. If set to `False` the auth library will not retry failed requests. If set to `True` the auth library will retry failed requests. The default value is `True` to maintain existing behavior. * Expanded list of HTTP Status codes that will be retried. * Modified retry behavior to use exponential backoff. * Increased default retry attempts from 2 to 3.
This reverts commit 06fff40.
retryable
property to auth library exceptions. This can beused to determine if an exception should be retried.
should_retry
parameter to token endpoints. If set toFalse
the auth library will not retry failed requests. If set to
True
theauth library will retry failed requests. The default value is
True
to maintain existing behavior.