Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Raise a warning in google.api_core.retry.retry_target if the return value is awaitable #542

Closed
@ohmayr

Description

@ohmayr

A warning can be raised within google.api_core.retry.retry_target depending on whether the return value of target() is awaitable in the following way:

if inspect.isawaitable(target()):
            raise ValueError("Incorrect use of Retry in async code. Use AsyncRetry instead")

This will ensure that google.api_core.retry.Retry is not incorrectly used in async clients/code and will suggest users to use google.api_core.retry_async.AsyncRetry instead

related issue: fix retries in async client

Metadata

Metadata

Assignees

Labels

type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions