Skip to content

Commit 35d7566

Browse files
Fix: change default HTTP timeout to 60s (#1301)
## What changes are proposed in this pull request? This PR fixes the default configuration for HTTP timeout. A couple of months ago we increased the timeout to 60s, but that was a no-op because of this line that sets it to 30 seconds. I caught it after noticing a couple of `request timed out after 30s of inactivity` during testing. ## How is this tested? Existing unit test. NO_CHANGELOG=true
1 parent 42ad9a8 commit 35d7566

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

httpclient/api_client.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ func (cfg ClientConfig) httpTransport() http.RoundTripper {
106106

107107
func NewApiClient(cfg ClientConfig) *ApiClient {
108108
// Set defaults for config values that are not set.
109-
cfg.HTTPTimeout = time.Duration(orDefault(int(cfg.HTTPTimeout), int(30*time.Second)))
110109
cfg.DebugTruncateBytes = orDefault(cfg.DebugTruncateBytes, 96)
111110
cfg.RetryTimeout = time.Duration(orDefault(int(cfg.RetryTimeout), int(5*time.Minute)))
112111
cfg.HTTPTimeout = time.Duration(orDefault(int(cfg.HTTPTimeout), int(60*time.Second)))

httpclient/api_client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,8 @@ func TestLogCancelledRequest(t *testing.T) {
530530
err := c.Do(context.Background(), "GET", "/a")
531531
assert.Error(t, err)
532532
assert.Equal(t, `[DEBUG] GET /a
533-
< Error: Get "/a": request timed out after 30s of inactivity
534-
[DEBUG] non-retriable error: Get "/a": request timed out after 30s of inactivity
533+
< Error: Get "/a": request timed out after 1m0s of inactivity
534+
[DEBUG] non-retriable error: Get "/a": request timed out after 1m0s of inactivity
535535
`, bufLogger.String())
536536
}
537537

0 commit comments

Comments
 (0)