Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 42a80db

Browse filesBrowse files
pepehnicolas-grekas
authored andcommitted
[Messenger] Fix support for Redis Sentinel using php-redis 6.0.0
1 parent ff29a1a commit 42a80db
Copy full SHA for 42a80db

File tree

1 file changed

+15
-1
lines changed
Filter options

1 file changed

+15
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php
+15-1Lines 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 (\extension_loaded('redis') && 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.