Disque\Connection\Manager::findAvailableConnection PHP Method

findAvailableConnection() protected method

Disque suggests the first connection should be chosen randomly We go through the user-supplied credentials randomly and try to connect.
protected findAvailableConnection ( ) : Node
return Disque\Connection\Node\Node A connected node
    protected function findAvailableConnection()
    {
        $servers = $this->credentials;
        shuffle($servers);
        foreach ($servers as $server) {
            try {
                $node = $this->getNodeConnection($server);
            } catch (ConnectionException $e) {
                continue;
            }
            if ($node->isConnected()) {
                return $node;
            }
        }
        throw new ConnectionException('No servers available');
    }