Skip to content

Commit 77db60c

Browse files
committed
[Messenger] Fix support for Redis Sentinel using php-redis 6.0.0
1 parent 7ebd082 commit 77db60c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,21 @@ public function __construct(array $options, \Redis|Relay|\RedisCluster $redis =
9494
} else {
9595
if (null !== $sentinelMaster) {
9696
$sentinelClass = \extension_loaded('redis') ? \RedisSentinel::class : Sentinel::class;
97-
$sentinelClient = new $sentinelClass($host, $port, $options['timeout'], $options['persistent_id'], $options['retry_interval'], $options['read_timeout']);
97+
98+
if (version_compare(phpversion('redis'), '6.0.0', '>=')) {
99+
$params = [
100+
'host' => $host,
101+
'port' => $port,
102+
'connectTimeout' => $options['timeout'],
103+
'persistent' => $options['persistent_id'],
104+
'retryInterval' => $options['retry_interval'],
105+
'readTimeout' => $options['read_timeout'],
106+
];
107+
108+
$sentinelClient = new \RedisSentinel($params);
109+
} else {
110+
$sentinelClient = new $sentinelClass($host, $port, $options['timeout'], $options['persistent_id'], $options['retry_interval'], $options['read_timeout']);
111+
}
98112

99113
if (!$address = $sentinelClient->getMasterAddrByName($sentinelMaster)) {
100114
throw new InvalidArgumentException(sprintf('Failed to retrieve master information from master name "%s" and address "%s:%d".', $sentinelMaster, $host, $port));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy