Skip to content
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

Add support for an Asynchronous Timeout Context Manager #1570

Open
ohmayr opened this issue Aug 2, 2024 · 0 comments
Open

Add support for an Asynchronous Timeout Context Manager #1570

ohmayr opened this issue Aug 2, 2024 · 0 comments
Assignees

Comments

@ohmayr
Copy link
Contributor

ohmayr commented Aug 2, 2024

The Asynchronous Authorized Session API needs to support max_allowed_time as a parameter to the request method, to allow users to configure the total method execution time i.e. if the method is run longer than this, then a timeout exception is raised.

An asynchronous timeout context manager can be implemented to support this, similar to google.auth.transport.requests.TimeoutGuard which will enforce timeout on an asynchronous block of code using asyncio.wait_for() and keep the timeout logic separate from the core AuthorizedSession.request API logic.

Why do we not re-use the synchronous timeout guard?

  • to keep the sync and async code paths separate.
  • It is implemented specifically to support the timeout type for the underlying requests API i.e. a tuple.
  • It will not enforce timeout on an async block of code and will not raise an exception until the async block of code has completed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant