tenacity icon indicating copy to clipboard operation
tenacity copied to clipboard

Support Trio out-of-the-box

Open njsmith opened this issue 3 years ago • 5 comments

This PR makes @retry just work when running under Trio.

For now, I added trio to the test deps in tox.ini, so we can test it. The code is also designed to handle things gracefully if trio isn't installed, but currently there's not any automated test for that... how would you like to handle this? Maybe add another test environment without trio?

njsmith avatar Apr 25 '21 22:04 njsmith

@jd How's this look?

njsmith avatar Apr 27 '21 16:04 njsmith

Fair enough!

njsmith avatar Apr 27 '21 22:04 njsmith

Made that change and also rebased on latest master, to make mergify happy

njsmith avatar Apr 27 '21 22:04 njsmith

Hello @njsmith ! I understand it has been over 2 years since this PR was opened. Might there be any chance of a follow-up to support trio out of the box?

I think this feature is great, as it can be easy to forget add trio.sleep argument to the retry.

chrisjwelly avatar Nov 15 '23 01:11 chrisjwelly

I also wonder how to use tenacity with trio.

If I use tenacity.retry() as a decorator for a async function, how can I check the result of the async function via tenacity.retry_if_result()? And then I got an error TypeError: argument of type 'coroutine' is not iterable, xxx was never awaited.

Even if I change my retry condition to retry_if_exception, I got another error TypeError: object NoneType can't be used in 'await' expression.

Please give me some tips, thank you guys~~~

SysuJayce avatar Dec 28 '23 12:12 SysuJayce