Skip to content

Commit

Permalink
Merge pull request #120 from DopplerHQ/tom_max_idle_conns
Browse files Browse the repository at this point in the history
Increase max number of idle connections per host
  • Loading branch information
Piccirello authored Aug 31, 2020
2 parents 679cd51 + 692683d commit 530a470
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,22 @@ func performRequest(req *http.Request, verifyTLS bool, params []queryParam) (int
}
req.URL.RawQuery = query.Encode()

// set timeout and tls config
client := &http.Client{}
// set http timeout
if UseTimeout {
client.Timeout = TimeoutDuration
}

// try to prevent "connect: cannot assign requested address" errors
// https://github.com/golang/go/issues/16012
transport := &http.Transport{MaxIdleConnsPerHost: 20}

// set TLS config
// #nosec G402
if !verifyTLS {
client.Transport = &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
client.Transport = transport

startTime := time.Now()
var response *http.Response
Expand Down

0 comments on commit 530a470

Please sign in to comment.