private function tryRequest(
        callable $callable,
        ?Retry $retry
    ): array {
        $tries = $retry instanceof Retry
            ? $retry->getRetries()
            : 0;

        while (true) {
            try {
                return $callable();
            } catch (\Exception $e) {
                if ($tries-- <= 0) {
                    throw $e;
                }

                usleep($retry->getMicrosecondsBetweenRetries());
            }
        }
    }
private function tryRequest(
        callable $callable,
        ?Retry $retry
    ): array {
        $tries = $retry instanceof Retry
            ? $retry->getRetries()
            : 0;

        while (true) {
            try {
                return $callable();
            } catch (\Exception $e) {
                if ($tries-- <= 0) {
                    throw $e;
                }

                usleep($retry->getMicrosecondsBetweenRetries());
            }
        }
    }
private function tryRequest ( callable $ callable , ? Retry $ retry ) : array { $ tries = $ retry instanceof Retry ? $ retry -> getRetries ( ) : 0 ; while ( true ) { try { return $ callable ( ) ; } catch ( \ Exception $ e ) { if ( $ tries -- <= 0 ) { throw $ e ; } usleep ( $ retry -> getMicrosecondsBetweenRetries ( ) ) ; } } }
Try connection and return result.

Retry n times this connection before returning response.

@param callable   $callable
@param Retry|null $retry

@return array

@throws Exception
Try connection and return result .