fix(inputs.burrow): Move Dialer to variable and run `make fmt` (#11149)
This commit is contained in:
parent
81b84fb12b
commit
b709f8e047
|
|
@ -170,20 +170,21 @@ func (b *burrow) createClient() (*http.Client, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout := time.Duration(b.ResponseTimeout)
|
timeout := time.Duration(b.ResponseTimeout)
|
||||||
|
dialContext := net.Dialer{Timeout: timeout, DualStack: true}
|
||||||
transport := http.Transport{
|
transport := http.Transport{
|
||||||
DialContext: &net.Dialer{Timeout: timeout, DualStack: true}.DialContext,
|
DialContext: dialContext.DialContext,
|
||||||
TLSClientConfig: tlsCfg,
|
TLSClientConfig: tlsCfg,
|
||||||
// If b.ConcurrentConnections <= 1, then DefaultMaxIdleConnsPerHost is used (=2)
|
// If b.ConcurrentConnections <= 1, then DefaultMaxIdleConnsPerHost is used (=2)
|
||||||
MaxIdleConnsPerHost: b.ConcurrentConnections / 2,
|
MaxIdleConnsPerHost: b.ConcurrentConnections / 2,
|
||||||
// If b.ConcurrentConnections == 0, then it is treated as "no limits"
|
// If b.ConcurrentConnections == 0, then it is treated as "no limits"
|
||||||
MaxConnsPerHost: b.ConcurrentConnections,
|
MaxConnsPerHost: b.ConcurrentConnections,
|
||||||
ResponseHeaderTimeout: timeout,
|
ResponseHeaderTimeout: timeout,
|
||||||
IdleConnTimeout: 90*time.Second,
|
IdleConnTimeout: 90 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
client := &http.Client{
|
client := &http.Client{
|
||||||
Transport: &transport,
|
Transport: &transport,
|
||||||
Timeout: timeout,
|
Timeout: timeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
return client, nil
|
return client, nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue