protected function retryOnFailure(callable $callback)
    {
        $attempts = 0;

        do {
            try {
                return $callback();
            } catch (CommunicationException $exception) {
                $exception->getConnection()->disconnect();
                $this->client->getConnection()->querySentinel();

                usleep($this->retryWait * 1000);

                $attempts++;
            }
        } while ($attempts <= $this->retryLimit);

        throw $exception;
    }
protected function retryOnFailure(callable $callback)
    {
        $attempts = 0;

        do {
            try {
                return $callback();
            } catch (CommunicationException $exception) {
                $exception->getConnection()->disconnect();
                $this->client->getConnection()->querySentinel();

                usleep($this->retryWait * 1000);

                $attempts++;
            }
        } while ($attempts <= $this->retryLimit);

        throw $exception;
    }
protected function retryOnFailure ( callable $ callback ) { $ attempts = 0 ; do { try { return $ callback ( ) ; } catch ( CommunicationException $ exception ) { $ exception -> getConnection ( ) -> disconnect ( ) ; $ this -> client -> getConnection ( ) -> querySentinel ( ) ; usleep ( $ this -> retryWait * 1000 ) ; $ attempts ++ ; } } while ( $ attempts <= $ this -> retryLimit ) ; throw $ exception ; }
Attempt to retry the provided operation when the client fails to connect
to a Redis server.

We adapt Predis' Sentinel connection failure handling logic here to
reproduce the high-availability mode provided by the actual client. To
work around "aggregate" connection limitations in Predis, this class
provides methods that don't use the high-level Sentinel connection API
of Predis directly, so it needs to handle connection failures itself.

@param callable $callback The operation to execute.

@return mixed The result of the first successful attempt.

@throws CommunicationException After exhausting the allowed number of
attempts to reconnect.
Attempt to retry the provided operation when the client fails to connect to a Redis server .