Skip to content

Commit

Permalink
fix(inputs.burrow): Move Dialer to variable and run make fmt (#11149)
Browse files Browse the repository at this point in the history
  • Loading branch information
sspaink authored May 19, 2022
1 parent 81b84fb commit b709f8e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions plugins/inputs/burrow/burrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,21 @@ func (b *burrow) createClient() (*http.Client, error) {
}

timeout := time.Duration(b.ResponseTimeout)
dialContext := net.Dialer{Timeout: timeout, DualStack: true}
transport := http.Transport{
DialContext: &net.Dialer{Timeout: timeout, DualStack: true}.DialContext,
DialContext: dialContext.DialContext,
TLSClientConfig: tlsCfg,
// If b.ConcurrentConnections <= 1, then DefaultMaxIdleConnsPerHost is used (=2)
MaxIdleConnsPerHost: b.ConcurrentConnections / 2,
// If b.ConcurrentConnections == 0, then it is treated as "no limits"
MaxConnsPerHost: b.ConcurrentConnections,
MaxConnsPerHost: b.ConcurrentConnections,
ResponseHeaderTimeout: timeout,
IdleConnTimeout: 90*time.Second,
IdleConnTimeout: 90 * time.Second,
}

client := &http.Client{
Transport: &transport,
Timeout: timeout,
Timeout: timeout,
}

return client, nil
Expand Down

0 comments on commit b709f8e

Please sign in to comment.