We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
async functools.singledispatch or functools.singledispatchmethod decorated functions are not retried using tenacity:
functools.singledispatch
functools.singledispatchmethod
import asyncio import tenacity from functools import singledispatch @tenacity.retry( retry=tenacity.retry_if_exception_type(RuntimeError), stop=tenacity.stop_after_attempt(2), ) @singledispatch async def foo(a: str): raise RuntimeError() asyncio.run(foo("test")) # RuntimeError
The example is not retried and raises RuntimeError instead of tenacity.RetryError.
RuntimeError
tenacity.RetryError
The reason is that inspect.iscoroutinefunction is used under the hood, which produces false negatives for singledispatch functions and methods.
inspect.iscoroutinefunction
singledispatch
from functools import singledispatch from inspect import iscoroutinefunction @singledispatch async def foo(a: str): raise RuntimeError() assert iscoroutinefunction(foo) # AssertionError
The text was updated successfully, but these errors were encountered:
Perhaps you could customize a decorator to support the RuntimeError exception.
#412 (comment)
Sorry, something went wrong.
No branches or pull requests
async
functools.singledispatch
orfunctools.singledispatchmethod
decorated functions are not retried using tenacity:The example is not retried and raises
RuntimeError
instead oftenacity.RetryError
.The reason is that
inspect.iscoroutinefunction
is used under the hood, which produces false negatives forsingledispatch
functions and methods.The text was updated successfully, but these errors were encountered: