lib/RetryMiddlewareFactory.php
private static function buildRetryDecider()
    {
        return function (
            $retries,
            \GuzzleHttp\Psr7\Request $request,
            \GuzzleHttp\Psr7\Response $response = null,
            \GuzzleHttp\Exception\RequestException $exception = null
        ) {
            if ($retries >= self::MAX_AUTOMATIC_TIMEOUT_RETRIES) {
                return false;
            }

            if (!self::isConnectionError($exception) && !self::isRetryableServerError($response)) {
                return false;
            }

            if ($request->getMethod() == "GET" || $request->getMethod() == "PUT") {
                return true;
            }

            $path = $request->getUri()->getPath();

            if ($request->getMethod() == "POST") {
                if (!preg_match(self::ACTIONS_PATH_REGEX, $path)) {
                    return true;
                }
            }

            return false;
        };
    }
private static function buildRetryDecider()
    {
        return function (
            $retries,
            \GuzzleHttp\Psr7\Request $request,
            \GuzzleHttp\Psr7\Response $response = null,
            \GuzzleHttp\Exception\RequestException $exception = null
        ) {
            if ($retries >= self::MAX_AUTOMATIC_TIMEOUT_RETRIES) {
                return false;
            }

            if (!self::isConnectionError($exception) && !self::isRetryableServerError($response)) {
                return false;
            }

            if ($request->getMethod() == "GET" || $request->getMethod() == "PUT") {
                return true;
            }

            $path = $request->getUri()->getPath();

            if ($request->getMethod() == "POST") {
                if (!preg_match(self::ACTIONS_PATH_REGEX, $path)) {
                    return true;
                }
            }

            return false;
        };
    }
private static function buildRetryDecider ( ) { return function ( $ retries , \ GuzzleHttp \ Psr7 \ Request $ request , \ GuzzleHttp \ Psr7 \ Response $ response = null , \ GuzzleHttp \ Exception \ RequestException $ exception = null ) { if ( $ retries >= self :: MAX_AUTOMATIC_TIMEOUT_RETRIES ) { return false ; } if ( ! self :: isConnectionError ( $ exception ) && ! self :: isRetryableServerError ( $ response ) ) { return false ; } if ( $ request -> getMethod ( ) == "GET" || $ request -> getMethod ( ) == "PUT" ) { return true ; } $ path = $ request -> getUri ( ) -> getPath ( ) ; if ( $ request -> getMethod ( ) == "POST" ) { if ( ! preg_match ( self :: ACTIONS_PATH_REGEX , $ path ) ) { return true ; } } return false ; } ; }
Internal function for building a retry decider for the Guzzle Retry middleware
@return callable A function called to decide whether to retry a request
Internal function for building a retry decider for the Guzzle Retry middleware