Merge pull request #920 from jaffee/v0.7

bump http client's MaxIdleConns and MaxIdleConnsPerHost
This commit is contained in:
Matthew Jaffee 2017-11-02 13:59:33 -05:00 • committed by GitHub
commit 9ed91cac28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,7 @@ import (
"errors"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"sort"
@ -57,7 +58,21 @@ type Executor struct {
// NewExecutor returns a new instance of Executor.
func NewExecutor() *Executor {
return &Executor{
HTTPClient: http.DefaultClient,
HTTPClient: &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
MaxIdleConns: 1000,
MaxIdleConnsPerHost: 200,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
},
},
}
}