Merge pull request #277 from QiWang19/retry-eof
Enable retry EOF from http request
This commit is contained in:
commit
e5ea066b38
|
|
@ -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 { // Happens when a server accepts a HTTP connection and sends 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