From fe9024bfa616cdaf261bb97a04eec5416c6f6941 Mon Sep 17 00:00:00 2001 From: Cody Oss Date: Fri, 18 Nov 2022 14:40:11 -0600 Subject: [PATCH] fix(compute/metadata): set IdleConnTimeout for http.Client 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 --- compute/metadata/metadata.go | 1 + 1 file changed, 1 insertion(+) diff --git a/compute/metadata/metadata.go b/compute/metadata/metadata.go index 50538b1d343..d4aad9bf395 100644 --- a/compute/metadata/metadata.go +++ b/compute/metadata/metadata.go @@ -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, }