8000 [Cache] Make use of `read_timeout` in `\RedisSentinel` and `\Redis` · symfony/symfony@14e36a2 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 14e36a2

Browse files
committed
[Cache] Make use of read_timeout in \RedisSentinel and \Redis
Both classes have an optional argument `$readTimeout` that can be set during initialization for `\RedisSentinel` and during `connect`/`pconnect` respectively.
1 parent 19b20ab commit 14e36a2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,15 @@ public static function createConnection($dsn, array $options = [])
184184
$port = $hosts[0]['port'] ?? null;
185185

186186
if (isset($params['redis_sentinel'])) {
187-
$sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval']);
187+
$sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout']);
188188

189189
if (![$host, $port] = $sentinel->getMasterAddrByName($params['redis_sentinel'])) {
190190
throw new InvalidArgumentException(sprintf('Failed to retrieve master information from master name "%s" and address "%s:%d".', $params['redis_sentinel'], $host, $port));
191191
}
192192
}
193193

194194
try {
195-
@$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval']);
195+
@$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout']);
196196

197197
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
198198
$isConnected = $redis->isConnected();

0 commit comments

Comments
 (0)
0