Skip to content

Commit

Permalink
Make the default timout 5 minutes when timeout is 0 (hashicorp#227)
Browse files Browse the repository at this point in the history
<!-- This change is generated by MagicModules. -->
/cc @chrisst
  • Loading branch information
modular-magician authored and chrisst committed Dec 17, 2018
1 parent 5b5c78d commit 881cd1a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion google-beta/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,18 @@ 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) {
reqHeaders := make(http.Header)
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 {
Expand Down

0 comments on commit 881cd1a

Please sign in to comment.