Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow asynchronous callbacks for async retries. #355

Closed
wants to merge 1 commit into from

Conversation

mastizada
Copy link

This change will allow both async and sync functions to be used as callable parameters for Async retries.

Docs are not updated, please, inform if any other changes are needed. Thank you very much for your review.

Fixes #249



class AsyncRetrying(BaseRetrying):
def __init__(self, sleep: typing.Callable[[float], typing.Awaitable] = sleep, **kwargs: typing.Any) -> None:
def __init__(self, sleep: Callable[[float], Awaitable] = aio_sleep, **kwargs: Any) -> None:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are too many changes that are unrelated to this PR.
Could you avoid changing code that does not need to be changed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was giving warnings because variable and function had same names (sleep), should I make another PR for this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, writing typing. before types every time made some lines too long, and it was looking unnecessary, should I revert that one too?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, anything that is not related to the change should be avoided.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for late response, I will try to find time in upcoming days and split this PR into 2 different PRs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a new PR with AsyncRetries related changes #363
Will make another PR for coding style improvements after that.

Closing this PR (will use this branch as template)

@mastizada mastizada marked this pull request as draft September 23, 2022 11:54
@mastizada mastizada closed this Sep 23, 2022
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