protected function getWrappedRedis($command, $key = null) { // we call the parent method, cause it does most of the work. it calls our activateNextConnection() in turn, which // sets the failover variables, if a different connection is connected. try { // this call will either return $this->curConn or throw an exception, and we don't need the return value parent::getWrappedRedis($command, $key); // if we are in failover mode, we always want to reactivate the first connection unless multi mode is active // this check is safe to do here, since we only do it when the last connection attempt has been some time ago, // which can never happen when the connection was just connected if ($this->isFailoverActive() && $this->lastConnectionAttempt + self::RETRY_INTERVAL < $this->time->current() && !$this->inMultiMode) { $this->activateFirstConnection(); } return $this->curConn; } catch (FailoverException $foe) { // catching this exception means that it was impossible to connect any connection, so there is nothing we can do throw new FailoverException(sprintf('could not connect to any host. configured connections: %s. offline since: %d', $this->connections->getUniqueId(), $this->failoverActiveSince), FailoverException::ERROR_NO_HEALTHY_CONNECTIONS, $foe); } }