jd / tenacity

Retrying library for Python
http://tenacity.readthedocs.io
Apache License 2.0
6.6k stars 281 forks source link

Add async strategies #451

Closed hasier closed 3 months ago

hasier commented 6 months ago

Third and last PR after breaking down https://github.com/jd/tenacity/pull/433 (follows ~https://github.com/hasier/tenacity/pull/1~ https://github.com/jd/tenacity/pull/437)

After DRYing the iter() function and making AsyncRetrying support async callbacks, add new async strategies (basically a copy-paste) and improve typing.

Supersedes https://github.com/hasier/tenacity/pull/2

mergify[bot] commented 6 months ago

⚠️ No release notes detected. Please make sure to use reno to add a changelog entry.

jd commented 5 months ago

@hasier sorry for the long delay, that PR slipped my mind. Don't hesitate to harass me more for reviews.

hasier commented 4 months ago

@jd sorry, I've been busy these last few days, could you take another look at my latest comment? 🙏

hasier commented 4 months ago

@jd any idea what might be going on with the Tornado tests? https://github.com/jd/tenacity/actions/runs/9347251510/job/25723863307?pr=451

jd commented 4 months ago

I think it's https://github.com/jd/tenacity/issues/460

hasier commented 3 months ago

@jd seems like a fix has already been merged and released for the Tornado issue. I guess that means you can close https://github.com/jd/tenacity/issues/460, as tests should automatically pick the latest version. Could you rerun the checks here as well, please? 🙏

jd commented 3 months ago

@mergify update

mergify[bot] commented 3 months ago

update

☑️ Nothing to do

- [ ] `#commits-behind>0` [📌 update requirement] - [X] `-closed` [📌 update requirement] - [X] `-conflict` [📌 update requirement] - [X] `queue-position=-1` [📌 update requirement]
jd commented 3 months ago

@hasier can we add a release note?

hasier commented 3 months ago

Add release note

Good point @jd, done! Let me know if you want me to amend in any way 🙂 https://github.com/jd/tenacity/pull/451/commits/4aa9ccf271cb37b0ac37437075bb25b033a2da0a

Also, I just realised finally I only added a base for retry, but nothing for stop or wait. Would you want me to replicate this together with the matching all/any to allow for easier extension of those in the future? Not sure if there might be similar use cases for those as I don't see them using any functions as predicates, but asking just in case.

hasier commented 3 months ago

Thanks for the review and merging @jd! 🙇 Are you expecting to release a new version soon? 😁

Knamdev commented 3 months ago

asyncio folder is missing under tenacity when downloaded