Repository navigation
Conversation
…HttpRetryOptions Include asyncio.TimeoutError and google.auth.exceptions.TimeoutError in _AIOHTTP_TRANSIENT_EXC, and match google.auth.exceptions.TransportError when its __cause__ is in _AIOHTTP_TRANSIENT_EXC, so async requests using aiohttp or AsyncAuthorizedSession retry transient timeouts and connection drops when HttpRetryOptions is configured (matching httpx in googleapis#2345). Fixes googleapis#3329.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #3329.
Summary
When
HttpRetryOptionsis configured andaiohttpis active (google-genai[aiohttp]), transient request timeouts andgoogle.auth.aio-wrapped transport errors bypassedretry_args()and surfaced on the first attempt.asyncio.TimeoutError(which also coversaiohttp.ServerTimeoutErrorandaiohttp.ConnectionTimeoutError) andgoogle.auth.exceptions.TimeoutError(raised bygoogle.auth.aio.transport.aiohttp.RequestandAsyncAuthorizedSession.requeston timeout) to_AIOHTTP_TRANSIENT_EXC, matchinghttpx.TimeoutExceptionin_HTTPX_TRANSIENT_EXC(httpx.TimeoutException is not retried despite HttpRetryOptions being configured #2337 / fix(retry): retry on httpx.TimeoutException with HttpRetryOptions #2345).retry_args(), also matchgoogle.auth.exceptions.TransportErrorwhene.__cause__is an instance of_AIOHTTP_TRANSIENT_EXC, aligningretry_args()with_async_request_once()'sexcept (..., auth_exceptions.TransportError): raise # HttpRetryOptions owns retries; tenacity decideswhile keeping non-transient errors (aiohttp.ClientPayloadError,google.auth.exceptions.RefreshError) non-retriable.HttpRetryOptionsis unset unchanged (client-side timeouts are not implicitly retried withoutretry_options).google/genai/tests/client/test_aiohttp_retries.pycoveringretry_args()predicates andasync_request()retry behavior forasyncio.TimeoutErrorandgoogle.auth.exceptions.TimeoutError.Testing