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;
        };
    }