Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2019-06-05 07:56:39 +0300
committerMichael Grunder <michael.grunder@gmail.com>2019-06-15 20:42:44 +0300
commit17600dd131a1ad11af081d0345a4627613f83b9d (patch)
treea1e0bfcefd75a0347450642e0c705224f6395ebb /cluster_library.c
parent68c83821b56c9e1f95fbd82e1c5e541b72e41831 (diff)
WIP: Enable pooling for cluster slave nodes.
Connections are stashed via redis_sock_disconnect so if RedisCluster doesn't explicitly call that for slaves then pooling is never used for those connections. Addresses #1568
Diffstat (limited to 'cluster_library.c')
-rw-r--r--cluster_library.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/cluster_library.c b/cluster_library.c
index 2e926963..564629b5 100644
--- a/cluster_library.c
+++ b/cluster_library.c
@@ -1256,11 +1256,19 @@ static int cluster_check_response(redisCluster *c, REDIS_REPLY_TYPE *reply_type
/* Disconnect from each node we're connected to */
PHP_REDIS_API void cluster_disconnect(redisCluster *c, int force TSRMLS_DC) {
- redisClusterNode *node;
+ redisClusterNode *node, *slave;
ZEND_HASH_FOREACH_PTR(c->nodes, node) {
if (node == NULL) continue;
+
+ /* Disconnect from the master */
redis_sock_disconnect(node->sock, force TSRMLS_CC);
+
+ /* We also want to disconnect any slave connections so they will be pooled
+ * in the event we are using persistent connections and connection pooling. */
+ ZEND_HASH_FOREACH_PTR(node->slaves, slave) {
+ redis_sock_disconnect(slave->sock, force TSRMLS_CC);
+ } ZEND_HASH_FOREACH_END();
} ZEND_HASH_FOREACH_END();
}