Open robert-schmidtke opened 1 month ago
I also found the timeout
/ wait_for_connection_timeout
options in the super
Redis backend, which may also be good candidates to use as timeouts for the listen task to start.
https://github.com/Krukov/cashews/blob/7.1.0/cashews/backends/redis/backend.py#L78
Hi @robert-schmidtke
Yes, sure , I like this idea to have a dedicated option for the operations in the listen task and for waiting for the task started ( or use the timeout
) .
Would you like to make a PR or I can take it ?
Thanks
Hey, thanks for offering to take it. I'm not sure I'll have the time soon, so please if you can, go ahead and add the feature to your preferences!
Hi @Krukov!
I'm using the Redis client-side caching feature, and every now and then obtaining the pubsub connection times out. So I read up in the code and noticed we could set
socket_timeout
, as this is used as the upper limit for the listen task to start. However, thissocket_timeout
is also used for all the regular cache reads, which I would rather not like to extend.There's also a
socket_connect_timeout
, which is used by Redis client internally on obtaining a connection.So would it make sense to have the listen task timeout be
socket_connect_timeout
instead? Or evensocket_connect_timeout + 5 * socket_timeout
, as there a ~5execute_command
operations used?Alternatively, a dedicated option
listen_timeout
orpubsub_timeout
(defaulting tosocket_timeout
orsocket_connect_timeout
) could be introduced?https://github.com/Krukov/cashews/blob/7.1.0/cashews/backends/redis/client_side.py#L91 https://github.com/Krukov/cashews/blob/7.1.0/cashews/backends/redis/client_side.py#L122-L129