tenacity icon indicating copy to clipboard operation
tenacity copied to clipboard

run_in_executor_call() in tenacity.AsyncRetrying

Open heri16 opened this issue 8 years ago • 0 comments

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...)

heri16 avatar Apr 26 '17 15:04 heri16