Set MaxIdleConnsPerHost alongside MaxIdleConns (#3592)
Otherwise it defaults to 2, and Go will close extra connections as soon as a request is finished. See https://github.com/golang/go/issues/13801
This commit is contained in:
parent
9083d41d3a
commit
a8cce41882
|
@ -43,6 +43,7 @@ func NewClientFromConfig(cfg config.HTTPClientConfig, name string) (*http.Client
|
||||||
var rt http.RoundTripper = &http.Transport{
|
var rt http.RoundTripper = &http.Transport{
|
||||||
Proxy: http.ProxyURL(cfg.ProxyURL.URL),
|
Proxy: http.ProxyURL(cfg.ProxyURL.URL),
|
||||||
MaxIdleConns: 20000,
|
MaxIdleConns: 20000,
|
||||||
|
MaxIdleConnsPerHost: 1000, // see https://github.com/golang/go/issues/13801
|
||||||
DisableKeepAlives: false,
|
DisableKeepAlives: false,
|
||||||
TLSClientConfig: tlsConfig,
|
TLSClientConfig: tlsConfig,
|
||||||
DisableCompression: true,
|
DisableCompression: true,
|
||||||
|
|
Loading…
Reference in New Issue