public function performRequest()

in src/OpenSearch/Transport.php [99:139]


    public function performRequest(string $method, string $uri, array $params = [], $body = null, array $options = []): FutureArrayInterface
    {
        try {
            $connection  = $this->getConnection();
        } catch (Exceptions\NoNodesAvailableException $exception) {
            $this->log->critical('No alive nodes found in cluster');
            throw $exception;
        }

        $response             = [];
        $caughtException      = null;
        $this->lastConnection = $connection;

        $future = $connection->performRequest(
            $method,
            $uri,
            $params,
            $body,
            $options,
            $this
        );

        $future->promise()->then(
            //onSuccess
            function ($response) {
                $this->retryAttempts = 0;
            // Note, this could be a 4xx or 5xx error
            },
            //onFailure
            function ($response) {
                $code = $response->getCode();
                // Ignore 400 level errors, as that means the server responded just fine
                if ($code < 400 || $code >= 500) {
                    // Otherwise schedule a check
                    $this->connectionPool->scheduleCheck();
                }
            }
        );

        return $future;
    }