Skip to content

Commit

Permalink
Merge pull request #124 from DopplerHQ/tom_disable_keepalive
Browse files Browse the repository at this point in the history
Disable HTTP keep-alives for client requests
  • Loading branch information
Piccirello authored Sep 10, 2020
2 parents 1cd02ee + 59283d8 commit 4c0154b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,11 @@ func performRequest(req *http.Request, verifyTLS bool, params []queryParam) (int
client.Timeout = TimeoutDuration
}

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

transport := &http.Transport{
// disable keep alives to prevent multiple CLI instances from exhausting the
// OS's available network sockets. this adds a negligible performance penalty
DisableKeepAlives: true,
}
// set TLS config
// #nosec G402
if !verifyTLS {
Expand Down

0 comments on commit 4c0154b

Please sign in to comment.