private static bool IsRetryable()

in src/Cli/func/Telemetry/PersistenceChannel/Sender.cs [284:311]


        private static bool IsRetryable(int? httpStatusCode, WebExceptionStatus webExceptionStatus)
        {
            switch (webExceptionStatus)
            {
                case WebExceptionStatus.ProxyNameResolutionFailure:
                case WebExceptionStatus.NameResolutionFailure:
                case WebExceptionStatus.Timeout:
                case WebExceptionStatus.ConnectFailure:
                    return true;
            }

            if (httpStatusCode == null)
            {
                return false;
            }

            switch (httpStatusCode.Value)
            {
                case 503: // Server in maintenance.
                case 408: // invalid request
                case 500: // Internal Server Error
                case 502: // Bad Gateway, can be common when there is no network.
                case 511: // Network Authentication Required
                    return true;
            }

            return false;
        }