Skip to content

Commit

Permalink
fix(compute/metadata): set IdleConnTimeout for http.Client (#7084)
Browse files Browse the repository at this point in the history
This helps clean up idled connections held by the keep-alive. The default transport set this to 90 seconds but since we declare our own the default zero value means they are never closed out if they are under the threshold for connections to keep alive(2).

Fixes: #5430
  • Loading branch information
codyoss committed Nov 18, 2022
1 parent 7c8cbcf commit 766516a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions compute/metadata/metadata.go
Expand Up @@ -70,6 +70,7 @@ func newDefaultHTTPClient() *http.Client {
Timeout: 2 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
IdleConnTimeout: 60 * time.Second,
},
Timeout: 5 * time.Second,
}
Expand Down

0 comments on commit 766516a

Please sign in to comment.