Closed chlp closed 1 month ago
In version 1.56.0, for non-idempotent requests, the framework will no longer automatically make retry decisions for users regardless of the error encountered. When the newly added field RetryIfErr
is not configured by the user, the default retry strategy is to never retry non-idempotent requests.
cli := HostClient{RetryIfErr: func(request *Request, attempts int, err error) (resetTimeout bool, retry bool) {
isIdempotent := request.Header.IsGet() || request.Header.IsHead() || request.Header.IsPut()
retry = true
if !isIdempotent && err != io.EOF {
retry = false
}
return
}}
Defining RetryIfErr
as shown below can replicate the behavior of version 1.55.0.
@newacorn wow, I see. I'll give it a try and come back to share results. Thank you so much!
yeah, it works, thanks again!
fasthttp.Client{
RetryIfErr: func(req *fasthttp.Request, attempts int, err error) (resetTimeout bool, retry bool) {
if err == io.EOF {
return false, true
}
return false, false
},
}
After upgrading to version 1.56.0, started encountering error
ErrConnectionClosed
In my case, I was sending a POST request. There is an inverse correlation between the error rate and RPS:
Rolled back to version 1.55.0, and the errors disappeared completely.