From 5b075c1eca57f5ca468f42a0c5b8844870dedb86 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 17 Dec 2018 12:53:06 -0800 Subject: [PATCH] Make the default timout 5 minutes when timeout is 0 (#2667) --- google/transport.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/google/transport.go b/google/transport.go index 8ba9ab41..3a6fe0c1 100644 --- a/google/transport.go +++ b/google/transport.go @@ -33,7 +33,7 @@ func isEmptyValue(v reflect.Value) bool { } func sendRequest(config *Config, method, rawurl string, body map[string]interface{}) (map[string]interface{}, error) { - return sendRequestWithTimeout(config, method, rawurl, body, 0) + return sendRequestWithTimeout(config, method, rawurl, body, 5*time.Minute) } func sendRequestWithTimeout(config *Config, method, rawurl string, body map[string]interface{}, timeout time.Duration) (map[string]interface{}, error) { @@ -41,6 +41,10 @@ func sendRequestWithTimeout(config *Config, method, rawurl string, body map[stri reqHeaders.Set("User-Agent", config.userAgent) reqHeaders.Set("Content-Type", "application/json") + if timeout == 0 { + timeout = time.Duration(1) * time.Hour + } + var res *http.Response err := retryTimeDuration( func() error {