Tim Starling has submitted this change and it was merged. Change subject: Fixed connection comparison in RedisConnectionPool::handleException(). ......................................................................
Fixed connection comparison in RedisConnectionPool::handleException(). * This was comparing a Redis with a RedisConnRef. Change-Id: I6353736c8ad42a18d90e8474d38398d305950346 --- M includes/clientpool/RedisConnectionPool.php 1 file changed, 10 insertions(+), 8 deletions(-) Approvals: Tim Starling: Verified; Looks good to me, approved jenkins-bot: Checked diff --git a/includes/clientpool/RedisConnectionPool.php b/includes/clientpool/RedisConnectionPool.php index 0c91222..8a3a1be 100644 --- a/includes/clientpool/RedisConnectionPool.php +++ b/includes/clientpool/RedisConnectionPool.php @@ -255,15 +255,14 @@ * object and let it be reopened during the next request. * * @param $server string - * @param $conn RedisConnRef + * @param $cref RedisConnRef * @param $e RedisException * @return void */ - public function handleException( $server, RedisConnRef $conn, RedisException $e ) { - wfDebugLog( 'redis', - "Redis exception on server $server: " . $e->getMessage() . "\n" ); + public function handleException( $server, RedisConnRef $cref, RedisException $e ) { + wfDebugLog( 'redis', "Redis exception on server $server: " . $e->getMessage() . "\n" ); foreach ( $this->connections[$server] as $key => $connection ) { - if ( $connection['conn'] === $conn ) { + if ( $cref->isConnIdentical( $connection['conn'] ) ) { $this->idlePoolSize -= $connection['free'] ? 1 : 0; unset( $this->connections[$server][$key] ); break; @@ -281,11 +280,10 @@ class RedisConnRef { /** @var RedisConnectionPool */ protected $pool; - - protected $server; // string - /** @var Redis */ protected $conn; + + protected $server; // string /** * @param $pool RedisConnectionPool @@ -302,6 +300,10 @@ return call_user_func_array( array( $this->conn, $name ), $arguments ); } + public function isConnIdentical( Redis $conn ) { + return $this->conn === $conn; + } + function __destruct() { $this->pool->freeConnection( $this->server, $this->conn ); } -- To view, visit https://gerrit.wikimedia.org/r/52995 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6353736c8ad42a18d90e8474d38398d305950346 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: IAlex <ialex.w...@gmail.com> Gerrit-Reviewer: Platonides <platoni...@gmail.com> Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits