summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorlowercase00 <21188280+lowercase00@users.noreply.github.com>2023-02-02 00:53:19 -0300
committerGitHub <noreply@github.com>2023-02-02 10:53:19 +0700
commitc2e6d953383bfe678c3ad13e4359e27f5feaba41 (patch)
tree45fbd82680511e871df24c1a1b9ba0876a54a829 /docs
parent436250d36ba5d90a4979fe919c5d902c57223a35 (diff)
downloadrq-c2e6d953383bfe678c3ad13e4359e27f5feaba41.tar.gz
Enhanced Redis Connection Reliability (#1753)
* Enhanced Redis Connection Reliability The Redis connection may fail for several reasons. As the connection can be (1) explicitly passed to the worker or (2) implicity set, this will improve the Connection configuration by setting a timeout to the socket, and adding an ExponentialBackoff Retry logic. * Simpler Connection logic * Add simple retry logic to Redis Connection Error * Make retry exponential, add keepalive & socket_connect_timeout * Handles configuration on Redis' connection pool * Simplifies timeout exception logic * Fix burst bug, add test * Add docs related to `socket_timeout`, improve compatibility with older RedisPy versions * Fixes * New timeout private method * Fix timeout
Diffstat (limited to 'docs')
-rw-r--r--docs/docs/connections.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/docs/connections.md b/docs/docs/connections.md
index 7e87b3a..8e563d9 100644
--- a/docs/docs/connections.md
+++ b/docs/docs/connections.md
@@ -142,3 +142,23 @@ SENTINEL: {'INSTANCES':[('remote.host1.org', 26379), ('remote.host2.org', 26379)
'DB': 2,
'MASTER_NAME': 'master'}
```
+
+
+### Timeout
+
+To avoid potential issues with hanging Redis commands, specifically the blocking `BLPOP` command,
+RQ automatically sets a `socket_timeout` value that is 10 seconds higher than the `default_worker_ttl`.
+
+If you prefer to manually set the `socket_timeout` value,
+make sure that the value being set is higher than the `default_worker_ttl` (which is 420 by default).
+
+```python
+from redis import Redis
+from rq import Queue
+
+conn = Redis('localhost', 6379, socket_timeout=500)
+q = Queue(connection=conn)
+```
+
+Setting a `socket_timeout` with a lower value than the `default_worker_ttl` will cause a `TimeoutError`
+since it will interrupt the worker while it gets new jobs from the queue.