Skip to content

Retries do no work with asyncio #2179

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

Closed
elemoine opened this issue May 12, 2022 · 2 comments · Fixed by #2180
Closed

Retries do no work with asyncio #2179

elemoine opened this issue May 12, 2022 · 2 comments · Fixed by #2180

Comments

@elemoine
Copy link
Contributor

elemoine commented May 12, 2022

We use redis.asyncio.StrictRedis and redis.asyncio.BlockingConnectionPool, with some specific Retry configuration:

from redis.asyncio import BlockingConnectionPool, StrictClient
from redis.exceptions import ConnectionError, TimeoutError
from redis.asyncio.retry import Retry

errors = (ConnectionError, TimeoutError)
retry = Retry(backoff=backoff, retries=retries, supported_errors=errors)
pool = BlockingConnectionPool(retry=retry, retry_on_timeout=True)
client = StrictClient(connection_pool=pool)

And that doesn't work as expected! There are no retries at all on ConnectionError exceptions!

Here's what happens:

When executing a command, an error handler is passed to call_with_retry. That error handler is the _disconnect_raise function, which re-raises the exception if that exception is not a TimeoutError. Meaning that, in case of a ConnectionError, call_with_retry will raise and exit before having a chance to retry the operation.

@donbowman
Copy link
Contributor

does this relate to #1485
?

@elemoine
Copy link
Contributor Author

@donbowman no, this issue (and corresponding PR) is specific to the async API.

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 a pull request may close this issue.

2 participants