Skip to content

Commit 584af8d

Browse files
Merge branch '6.3' into 6.4
* 6.3: [Messenger] Fix support for Redis Sentinel using php-redis 6.0.0
2 parents ecbe52e + 43a1fa1 commit 584af8d

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
@@ -108,7 +108,21 @@ public function __construct(array $options, \Redis|Relay|\RedisCluster $redis =
108108
}
109109

110110
try {
111-
$sentinel = new $sentinelClass($host, $port, $options['timeout'], $options['persistent_id'], $options['retry_interval'], $options['read_timeout']);
111+
if (\extension_loaded('redis') && version_compare(phpversion('redis'), '6.0.0', '>=')) {
112+
$params = [
113+
'host' => $host,
114+
'port' => $port,
115+
'connectTimeout' => $options['timeout'],
116+
'persistent' => $options['persistent_id'],
117+
'retryInterval' => $options['retry_interval'],
118+
'readTimeout' => $options['read_timeout'],
119+
];
120+
121+
$sentinel = new \RedisSentinel($params);
122+
} else {
123+
$sentinel = new $sentinelClass($host, $port, $options['timeout'], $options['persistent_id'], $options['retry_interval'], $options['read_timeout']);
124+
}
125+
112126
if ($address = $sentinel->getMasterAddrByName($sentinelMaster)) {
113127
[$host, $port] = $address;
114128
}

0 commit comments

Comments
 (0)