tenacity icon indicating copy to clipboard operation
tenacity copied to clipboard

Add `__aexit__`and `__aenter__` to AttemptManager

Open notypecheck opened this issue 1 year ago • 0 comments

AttemptManager currently doesn't support async context manager protocol, requiring nesting two times instead of one if you want to use an async context manager with retrying:

async for attempt in retrying:
    with retrying:
        async with ratelimit:
            ...

Because AttemptManager doesn't do any IO I think it should be ok to just call into sync __enter__ and __exit_

notypecheck avatar Jun 13 '24 05:06 notypecheck