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 9186d14

Browse filesBrowse files
bug #39433 [Cache] fix setting "read_timeout" when using Redis (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [Cache] fix setting "read_timeout" when using Redis | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Being inspired by #39431 Commits ------- 7acca31 [Cache] fix setting "read_timeout" when using Redis
2 parents fbe3123 + 7acca31 commit 9186d14
Copy full SHA for 9186d14

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/RedisTrait.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public static function createConnection($dsn, array $options = [])
176176

177177
$initializer = static function ($redis) use ($connect, $params, $dsn, $auth, $hosts) {
178178
try {
179-
@$redis->{$connect}($hosts[0]['host'] ?? $hosts[0]['path'], $hosts[0]['port'] ?? null, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval']);
179+
@$redis->{$connect}($hosts[0]['host'] ?? $hosts[0]['path'], $hosts[0]['port'] ?? null, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout']);
180180

181181
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
182182
$isConnected = $redis->isConnected();
@@ -188,7 +188,6 @@ public static function createConnection($dsn, array $options = [])
188188

189189
if ((null !== $auth && !$redis->auth($auth))
190190
|| ($params['dbindex'] && !$redis->select($params['dbindex']))
191-
|| ($params['read_timeout'] && !$redis->setOption(\Redis::OPT_READ_TIMEOUT, $params['read_timeout']))
192191
) {
193192
$e = preg_replace('/^ERR /', '', $redis->getLastError());
194193
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e.'.');
@@ -215,6 +214,7 @@ public static function createConnection($dsn, array $options = [])
215214
}
216215
$params['lazy_connect'] = $params['lazy'] ?? true;
217216
$params['connect_timeout'] = $params['timeout'];
217+
$params['read_timeout'] = $params['read_timeout'];
218218

219219
try {
220220
$redis = new $class($hosts, $params);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.