Skip to content

Conversation

@hasier
Copy link
Contributor

@hasier hasier commented Jan 29, 2024

Fixes #249
Follows up on #289 #363

I took a stab at DRYing the iter() function in order to support async callbacks, and once those were possible, I thought it would also make sense to allow for async strategies.

The approach I have taken is to build a list of actions that iter() needs to go through, where each action is just a piece of the whole current logic, and each step can further extend the list of actions. 3 pieces have been taken out to redefine in specific Retrying implementations, i.e. asyncio. This way we can make sure we use coroutines for those calls, as well as dynamically wrapping each function as a coroutine, allowing for both sync and async strategies and callbacks.

I tried to make somewhat meaningful commits, it should be easier to review commit-by-commit.

I appreciate the new approach looks quite odd and is not very intuitive to follow, happy to take some feedback and improve it if anyone has some other ideas.

@mergify
Copy link
Contributor

mergify bot commented Jan 29, 2024

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

@jd
Copy link
Owner

jd commented Feb 2, 2024

Is there a way to split that in smaller changes? It's a bit large to review as is, even if it looks great

@hasier
Copy link
Contributor Author

hasier commented Feb 2, 2024

Is there a way to split that in smaller changes? It's a bit large to review as is, even if it looks great

@jd fair point. I have split it into 3 PRs, hopefully this works for you.

  1. Incrementally build iter actions list #434
  2. Support async actions hasier/tenacity#1 stacked on the previous one, but in my repo. Let me know if you prefer I did it against your main instead.
  3. Add async strategies hasier/tenacity#2 stacked on the previous one, but in my repo too. Let me know if you prefer I did it against your main instead.

@hasier hasier closed this Feb 6, 2024
@hasier hasier mentioned this pull request Feb 6, 2024
@hasier hasier mentioned this pull request Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is an async retry_error_callback possible?

2 participants