diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-02-11 16:18:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-11 16:18:37 +0100 |
commit | fbbbc2ec3445aa777f56c97a0a383a2e8566be54 (patch) | |
tree | d6b7d3c17b3ef43d284a93f49d21ae73ccbf16e9 /lib/private | |
parent | bcc956753ba028d156892badec7994a08433584e (diff) | |
parent | 698a713904ca6a7267a931eb5a4e2574380f82c5 (diff) | |
download | nextcloud-server-fbbbc2ec3445aa777f56c97a0a383a2e8566be54.tar.gz nextcloud-server-fbbbc2ec3445aa777f56c97a0a383a2e8566be54.zip |
Merge pull request #30959 from nextcloud/redis-pconnect
use persistent connections when connecting to redis
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/RedisFactory.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/private/RedisFactory.php b/lib/private/RedisFactory.php index 3062be28a78..88d22cf9d13 100644 --- a/lib/private/RedisFactory.php +++ b/lib/private/RedisFactory.php @@ -88,9 +88,9 @@ class RedisFactory { // Support for older phpredis versions not supporting connectionParameters if ($connectionParameters !== null) { - $this->instance = new \RedisCluster(null, $config['seeds'], $timeout, $readTimeout, false, $auth, $connectionParameters); + $this->instance = new \RedisCluster(null, $config['seeds'], $timeout, $readTimeout, true, $auth, $connectionParameters); } else { - $this->instance = new \RedisCluster(null, $config['seeds'], $timeout, $readTimeout, false, $auth); + $this->instance = new \RedisCluster(null, $config['seeds'], $timeout, $readTimeout, true, $auth); } if (isset($config['failover_mode'])) { @@ -119,9 +119,17 @@ class RedisFactory { $connectionParameters = [ 'stream' => $this->getSslContext($config) ]; - $this->instance->connect($host, $port, $timeout, null, 0, $readTimeout, $connectionParameters); + /** + * even though the stubs and documentation don't want you to know this, + * pconnect does have the same $connectionParameters argument connect has + * + * https://github.com/phpredis/phpredis/blob/0264de1824b03fb2d0ad515b4d4ec019cd2dae70/redis.c#L710-L730 + * + * @psalm-suppress TooManyArguments + */ + $this->instance->pconnect($host, $port, $timeout, null, 0, $readTimeout, $connectionParameters); } else { - $this->instance->connect($host, $port, $timeout, null, 0, $readTimeout); + $this->instance->pconnect($host, $port, $timeout, null, 0, $readTimeout); } |