Merge pull request #277 from QiWang19/retry-eof

Enable retry EOF from http request
This commit is contained in:
OpenShift Merge Robot 2020-08-23 06:49:15 -04:00 committed by GitHub
commit e5ea066b38
1 changed files with 5 additions and 1 deletions

View File

@ -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