-
-
Notifications
You must be signed in to change notification settings - Fork 428
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
does django-redis support retry on TimeOut Error while reading data? #667
Comments
@prasad5141 Were you able to execute the retry logic for n number of times by any chance? Thanks in advance. |
Is there any news on how to use the retry? |
sorry for the late reply, retry is not supported |
Hi @WisdomPill , Thanks for your reply, Shall I implement Retry? Plan of Implementation:
Please suggest to me if you have any other plan for retry, and I will try to implement it. |
okay, but by default the number of retries should be zero to not change the default behaviour |
It could be a set of settings within the redis configuration. one starting point could be to "copy" what redis-py does: https://redis-py.readthedocs.io/en/stable/retry.html so the setting could look like:
Still. not sure what could be supported. A retry for starting will be lovely. |
any update? @prasad5141 |
@esseti Mind if I take this over? I have some void time coming up and would like to contribute to this package :) |
I'd love some clarifications:
Does this signature sound fine? I can create a |
I just saw this: where you able to implement it ? |
@esseti I haven't implemented it, I'm still waiting on clarification for how the interface should look like. Let me know when you can please. |
Not sure what i can/cannot confirm, but just mimic the parameters of the client should work. that is:
|
it is something that has to be setup at the connection factory level, following the documentation of redis-py it seems to me that it can be done by adding the right parameters here. So I changed my mind, maybe it is supported, but I didn't try it yet, I think it can be already done using some configuration like the following from redis.backoff import ExponentialBackoff
from redis.retry import Retry
retry = Retry(ExponentialBackoff(), 3)
retry_on_error=[BusyLoadingError, ConnectionError, TimeoutError]
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1",
"OPTIONS": {
"REDIS_CLIENT_KWARGS": {
"retry": retry,
"retry_on_error": retry_on_error
}
}
}
} or for timeouts only from redis.backoff import ExponentialBackoff
from redis.retry import Retry
retry = Retry(ExponentialBackoff(), 3)
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1",
"OPTIONS": {
"REDIS_CLIENT_KWARGS": {
"retry": retry,
"retry_on_timeout": True
}
}
}
} to make it easier and cleaner we could override to start @amingilani I would try to write some tests mimicking the redis-py ones |
This already works, but the documentation is wrong. You have to use |
I am using django-redis package version (4.12.1),
I am getting a TimeOut Exception(Intermittent issue) while reading data from the redis cache, I would like to Retry for some N number of time to fetch the data
I tried using these settings but retry is not happening "REDIS_CLIENT_KWARGS": {"retry_on_timeout": True}
Please let me know if any other settings are available to retry while reading data from redis using django-redis package.
The text was updated successfully, but these errors were encountered: