diff --git a/pkg/multicloud/google/google.go b/pkg/multicloud/google/google.go index a4235c55cb..8d1bd9fb52 100644 --- a/pkg/multicloud/google/google.go +++ b/pkg/multicloud/google/google.go @@ -22,6 +22,7 @@ import ( "net/http" "net/url" "strings" + "time" "unicode" "golang.org/x/oauth2" @@ -891,6 +892,7 @@ func _jsonRequest(cli *http.Client, method httputils.THttpMethod, url string, bo } else { log.Errorf("%s %s error: %v", method, url, err) } + retry := false for _, msg := range []string{ "EOF", "i/o timeout", @@ -898,10 +900,14 @@ func _jsonRequest(cli *http.Client, method httputils.THttpMethod, url string, bo "connection reset by peer", } { if strings.Index(err.Error(), msg) >= 0 { - continue + retry = true + break } } - return nil, err + if !retry { + return nil, err + } + time.Sleep(time.Second * 10) } return nil, err }