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 8c56020

Browse filesBrowse files
committed
bug #52896 [Messenger] Avoid reconnecting active Redis connections. (BusterNeece)
This PR was merged into the 5.4 branch. Discussion ---------- [Messenger] Avoid reconnecting active Redis connections. | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #45057 | License | MIT With the Messenger component's internal Redis Connection class, if you pass it a \Redis or \Relay instance that's already connected, it will still try to reconnect that instance using the host/port/etc. that's passed to the connection object's "options" array in the constructor. Not only does this cause problems when the Redis instance is already connected, but it also prevents you from, say, using socket connections instead (as the only connection method supported by the class itself is IP-based connections) and just passing in a ready-to-go Redis instance. This PR is a resubmission of #52811 targeting 5.4 as it's a bug fix. Commits ------- 650f153 bug #45057 [Messenger] Avoid reconnecting active Redis connections.
2 parents a3361bd + 650f153 commit 8c56020
Copy full SHA for 8c56020

File tree

Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-0
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
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ public function __construct(array $configuration, array $connectionCredentials =
117117
*/
118118
private static function initializeRedis(\Redis $redis, string $host, int $port, $auth, int $serializer, int $dbIndex): \Redis
119119
{
120+
if ($redis->isConnected()) {
121+
return $redis;
122+
}
123+
120124
$redis->connect($host, $port);
121125
$redis->setOption(\Redis::OPT_SERIALIZER, $serializer);
122126

0 commit comments

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