Fix random connection timeouts with Redis Cluster

When a node timeout occurs, then phpredis will try to connect to another
node, whose answer probably will be MOVED redirect. After this we need
more time to accomplish the redirection, otherwise we get "Timed out
attempting to find data in the correct node" error message.

Fixes #795 #888 #1142 #1385 #1633 #1707 #1811 #2407
This commit is contained in:
Jozsef Koszo
2024-03-17 07:44:49 +01:00
committed by Michael Grunder
parent 8323ddff80
commit eb7f31e7af
2 changed files with 2 additions and 2 deletions

View File

@@ -833,7 +833,7 @@ PHP_REDIS_API redisCluster *cluster_create(double timeout, double read_timeout,
c->err = NULL;
/* Set up our waitms based on timeout */
c->waitms = (long)(1000 * timeout);
c->waitms = (long)(1000 * (timeout + read_timeout));
/* Allocate our seeds hash table */
ALLOC_HASHTABLE(c->seeds);

View File

@@ -139,7 +139,7 @@ static void redis_cluster_init(redisCluster *c, HashTable *ht_seeds, double time
c->flags->timeout = timeout;
c->flags->read_timeout = read_timeout;
c->flags->persistent = persistent;
c->waitms = timeout * 1000L;
c->waitms = (long)(1000 * (timeout + read_timeout));
/* Attempt to load slots from cache if caching is enabled */
if (CLUSTER_CACHING_ENABLED()) {