tenacity
tenacity copied to clipboard
run_in_executor_call() in tenacity.AsyncRetrying
Many users might need to use traditional blocking libraries within their new asyncio projects or frameworks (e.g. uvloop, Sanic, aiohttp, aiosmtpd).
Provide a conveinience method for shortening the below within tenacity.AsyncRetrying class.
loop = asyncio.get_event_loop()
executor = None # Uses default executor
retrying = tenacity.AsyncRetrying()
response = yield from retrying.call(
loop.run_in_executor,
executor,
legacy_library.blocking_callable,
request, args...)