MCPcopy Create free account
hub / github.com/imroc/req / shouldRetryDial

Function shouldRetryDial

internal/http2/client_conn_pool.go:262–281  ·  view source on GitHub ↗

shouldRetryDial reports whether the current request should retry dialing after the call finished unsuccessfully, for example if the dial was canceled because of a context cancellation or deadline expiry.

(call *dialCall, req *http.Request)

Source from the content-addressed store, hash-verified

260// if the dial was canceled because of a context cancellation or
261// deadline expiry.
262func shouldRetryDial(call *dialCall, req *http.Request) bool {
263 if call.err == nil {
264 // No error, no need to retry
265 return false
266 }
267 if call.ctx == req.Context() {
268 // If the call has the same context as the request, the dial
269 // should not be retried, since any cancellation will have come
270 // from this request.
271 return false
272 }
273 if !errors.Is(call.err, context.Canceled) && !errors.Is(call.err, context.DeadlineExceeded) {
274 // If the call error is not because of a context cancellation or a deadline expiry,
275 // the dial should not be retried.
276 return false
277 }
278 // Only retry if the error is a context cancellation error or deadline expiry
279 // and the context associated with the call was canceled or expired.
280 return call.ctx.Err() != nil
281}

Callers 1

GetClientConnMethod · 0.85

Calls 3

ErrMethod · 0.80
ContextMethod · 0.65
IsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…