src/Pipeline/ConnectionErrorProof.php
protected function executeCluster(ClusterInterface $connection, \SplQueue $commands)
    {
        $responses = array();
        $sizeOfPipe = count($commands);
        $exceptions = array();

        foreach ($commands as $command) {
            $cmdConnection = $connection->getConnectionByCommand($command);

            if (isset($exceptions[spl_object_hash($cmdConnection)])) {
                continue;
            }

            try {
                $cmdConnection->writeRequest($command);
            } catch (CommunicationException $exception) {
                $exceptions[spl_object_hash($cmdConnection)] = $exception;
            }
        }

        for ($i = 0; $i < $sizeOfPipe; ++$i) {
            $command = $commands->dequeue();

            $cmdConnection = $connection->getConnectionByCommand($command);
            $connectionHash = spl_object_hash($cmdConnection);

            if (isset($exceptions[$connectionHash])) {
                $responses[$i] = $exceptions[$connectionHash];
                continue;
            }

            try {
                $responses[$i] = $cmdConnection->readResponse($command);
            } catch (CommunicationException $exception) {
                $responses[$i] = $exception;
                $exceptions[$connectionHash] = $exception;
            }
        }

        return $responses;
    }
protected function executeCluster(ClusterInterface $connection, \SplQueue $commands)
    {
        $responses = array();
        $sizeOfPipe = count($commands);
        $exceptions = array();

        foreach ($commands as $command) {
            $cmdConnection = $connection->getConnectionByCommand($command);

            if (isset($exceptions[spl_object_hash($cmdConnection)])) {
                continue;
            }

            try {
                $cmdConnection->writeRequest($command);
            } catch (CommunicationException $exception) {
                $exceptions[spl_object_hash($cmdConnection)] = $exception;
            }
        }

        for ($i = 0; $i < $sizeOfPipe; ++$i) {
            $command = $commands->dequeue();

            $cmdConnection = $connection->getConnectionByCommand($command);
            $connectionHash = spl_object_hash($cmdConnection);

            if (isset($exceptions[$connectionHash])) {
                $responses[$i] = $exceptions[$connectionHash];
                continue;
            }

            try {
                $responses[$i] = $cmdConnection->readResponse($command);
            } catch (CommunicationException $exception) {
                $responses[$i] = $exception;
                $exceptions[$connectionHash] = $exception;
            }
        }

        return $responses;
    }
protected function executeCluster ( ClusterInterface $ connection , \ SplQueue $ commands ) { $ responses = array ( ) ; $ sizeOfPipe = count ( $ commands ) ; $ exceptions = array ( ) ; foreach ( $ commands as $ command ) { $ cmdConnection = $ connection -> getConnectionByCommand ( $ command ) ; if ( isset ( $ exceptions [ spl_object_hash ( $ cmdConnection ) ] ) ) { continue ; } try { $ cmdConnection -> writeRequest ( $ command ) ; } catch ( CommunicationException $ exception ) { $ exceptions [ spl_object_hash ( $ cmdConnection ) ] = $ exception ; } } for ( $ i = 0 ; $ i < $ sizeOfPipe ; ++ $ i ) { $ command = $ commands -> dequeue ( ) ; $ cmdConnection = $ connection -> getConnectionByCommand ( $ command ) ; $ connectionHash = spl_object_hash ( $ cmdConnection ) ; if ( isset ( $ exceptions [ $ connectionHash ] ) ) { $ responses [ $ i ] = $ exceptions [ $ connectionHash ] ; continue ; } try { $ responses [ $ i ] = $ cmdConnection -> readResponse ( $ command ) ; } catch ( CommunicationException $ exception ) { $ responses [ $ i ] = $ exception ; $ exceptions [ $ connectionHash ] = $ exception ; } } return $ responses ; }
{@inheritdoc}
{