Fix roundtripper doesn't increase request timeout setting after each retry (#1216)
This commit is contained in:
@@ -26,7 +26,7 @@ import (
|
||||
|
||||
type (
|
||||
Error struct {
|
||||
err error
|
||||
err net.Error
|
||||
}
|
||||
)
|
||||
|
||||
@@ -92,6 +92,28 @@ func (e Error) IsConnRefusedError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsTimeoutError returns true if its a network timeout error
|
||||
func (e Error) IsTimeoutError() bool {
|
||||
if e.err.Timeout() {
|
||||
return true
|
||||
}
|
||||
|
||||
opErr, ok := e.err.(*net.OpError)
|
||||
if ok {
|
||||
switch t := opErr.Err.(type) {
|
||||
case *os.SyscallError:
|
||||
if errno, ok := t.Err.(syscall.Errno); ok {
|
||||
switch errno {
|
||||
case syscall.ETIMEDOUT:
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// IsUnsupportedProtoScheme returns true if an error is a "unsupported protocol scheme" error
|
||||
func (e Error) IsUnsupportedProtoScheme() bool {
|
||||
urlErr, ok := e.err.(*url.Error)
|
||||
|
||||
Reference in New Issue
Block a user