503Service Temporarily UnavailableThis status code is returned when the server is down for maintenance or is overloaded.If you experience this, please retry your request. Note that the Business Central service adds aretry-afterHTTP header when returning HTTP status 503. Please use thi...
.OrResult(res => res.StatusCode == HttpStatusCode.InternalServerError || res.StatusCode == HttpStatusCode.RequestTimeout) .CircuitBreakerAsync( 3, // 出现3次异常 TimeSpan.FromSeconds(20), // 断路器的时间(例如:设置为20秒,断路器两秒后自动由开启到关闭) (ex, ts) => { //熔断器开启事件...
注意: 第一、 <3>熔断的策略里,我们加了.OrResult(res => res.StatusCode == HttpStatusCode.InternalServerError || res.StatusCode == HttpStatusCode.RequestTimeout),网上的教程一般没有,这句话的意思是说,当请求返回的状态是500服务器异常或者请求超时,都计算在内。若没有这句话,对方的接口必须要抛异...
console.log('failed', retryCount);//条件:只可以 retry 3 次,只有 status 503 才 retryif(retryCount <= 3 && errorinstanceofHttpErrorResponse && error.status === 503) {returntimer(1000);//延迟 1 秒后才发出 retry request}else{returnerror;//其它情况不 retry,直接返回 error} }, resetOnSucc...
System.Exception: StatusCode: 503, ReasonPhrase: 'Service Unavailable', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers: { Server: Microsoft-HTTPAPI/2.0 Date: Thu, 27 Feb 2020 04:30:23 GMT Connection: close Content-Type: text/html; charset=us-ascii Content-Length...
return (message.StatusCode == HttpStatusCode.InternalServerError || message.StatusCode==HttpStatusCode.RequestTimeout); }).RetryAsync(20, (res, Index) => { Console.WriteLine($"执行错误,异常行为:{res?.Result}"); Console.WriteLine($"2第{Index}次重试"); ...
Code = 10010 } // RetryVerify 也可以为 nil , 当为 nil 时,默认重试规则为 http_code 为如下情况: // http.StatusRequestTimeout, 408 // http.StatusLocked, 423 // http.StatusTooEarly, 425 // http.StatusTooManyRequests, 429 // http.StatusServiceUnavailable, 503 // http.StatusGatewayTime...
默认重试规则为 http_code 为如下情况:// http.StatusRequestTimeout, 408// http.StatusLocked, 423// http.StatusTooEarly, 425// http.StatusTooManyRequests, 429// http.StatusServiceUnavailable, 503// http.StatusGatewayTimeout, 504// 使用时:httpclient.WithOnFailedRetry(3, time.Second*1, retry...
503Service Temporarily UnavailableThis status code is returned when the server is down for maintenance or is overloaded.If you experience this, please retry your request. Note that the Business Central service adds aretry-afterHTTP header when returning HTTP status 503. Please use this in your web...
// RetryVerify 也可以为 nil , 当为 nil 时,默认重试规则为 http_code 为如下情况: // http.StatusRequestTimeout, 408 // http.StatusLocked, 423 // http.StatusTooEarly, 425 // http.StatusTooManyRequests, 429 // http.StatusServiceUnavailable, 503 ...