Enable retry EOF from http request
If the *url.Error type error casued by EOF, enable to retry. Signed-off-by: Qi Wang <qiwan@redhat.com>
This commit is contained in:
parent
0f5b7db0f3
commit
499c4ef5a7
|
|
@ -2,6 +2,7 @@ package retry
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"io"
|
||||||
"math"
|
"math"
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
@ -58,7 +59,10 @@ func isRetryable(err error) bool {
|
||||||
return true
|
return true
|
||||||
case *net.OpError:
|
case *net.OpError:
|
||||||
return isRetryable(e.Err)
|
return isRetryable(e.Err)
|
||||||
case *url.Error:
|
case *url.Error: // This includes errors returned by the net/http client.
|
||||||
|
if e.Err == io.EOF {
|
||||||
|
return true
|
||||||
|
}
|
||||||
return isRetryable(e.Err)
|
return isRetryable(e.Err)
|
||||||
case syscall.Errno:
|
case syscall.Errno:
|
||||||
return e != syscall.ECONNREFUSED
|
return e != syscall.ECONNREFUSED
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue