feat: [inputs/burrow] fill more http transport parameters (#6948)
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
This commit is contained in:
parent
9a6816782b
commit
7c89a38d11
|
|
@ -3,6 +3,7 @@ package burrow
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
|
@ -168,11 +169,21 @@ func (b *burrow) createClient() (*http.Client, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
timeout := time.Duration(b.ResponseTimeout)
|
||||
transport := http.Transport{
|
||||
DialContext: &net.Dialer{Timeout: timeout, DualStack: true}.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,
|
||||
ResponseHeaderTimeout: timeout,
|
||||
IdleConnTimeout: 90*time.Second,
|
||||
}
|
||||
|
||||
client := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: tlsCfg,
|
||||
},
|
||||
Timeout: time.Duration(b.ResponseTimeout),
|
||||
Transport: &transport,
|
||||
Timeout: timeout,
|
||||
}
|
||||
|
||||
return client, nil
|
||||
|
|
|
|||
Loading…
Reference in New Issue