mirror of
https://github.com/php-win-ext/phpredis.git
synced 2026-03-24 00:52:16 +01:00
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:
committed by
michael-grunder
parent
98d64ba86f
commit
1af521ac65
@@ -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);
|
||||
|
||||
@@ -381,7 +381,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()) {
|
||||
|
||||
Reference in New Issue
Block a user