Increase MaxIdlConnsPerHost to 25

This commit is contained in:
Wojciech Tyczynski 2016-05-31 13:16:06 +02:00
parent b67a6e6d41
commit 2ab3f1e1d5

View File

@ -34,6 +34,8 @@ type tlsTransportCache struct {
transports map[string]*http.Transport transports map[string]*http.Transport
} }
const idleConnsPerHost = 25
var tlsCache = &tlsTransportCache{transports: make(map[string]*http.Transport)} var tlsCache = &tlsTransportCache{transports: make(map[string]*http.Transport)}
func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) { func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) {
@ -66,6 +68,7 @@ func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) {
Proxy: http.ProxyFromEnvironment, Proxy: http.ProxyFromEnvironment,
TLSHandshakeTimeout: 10 * time.Second, TLSHandshakeTimeout: 10 * time.Second,
TLSClientConfig: tlsConfig, TLSClientConfig: tlsConfig,
MaxIdleConnsPerHost: idleConnsPerHost,
Dial: (&net.Dialer{ Dial: (&net.Dialer{
Timeout: 30 * time.Second, Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second, KeepAlive: 30 * time.Second,