mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Merge pull request #48736 from laurazard/client-set-conn-timeout
client: prevent idle connections leaking FDs
This commit is contained in:
@@ -247,6 +247,14 @@ func (cli *Client) tlsConfig() *tls.Config {
|
||||
|
||||
func defaultHTTPClient(hostURL *url.URL) (*http.Client, error) {
|
||||
transport := &http.Transport{}
|
||||
// Necessary to prevent long-lived processes using the
|
||||
// client from leaking connections due to idle connections
|
||||
// not being released.
|
||||
// TODO: see if we can also address this from the server side,
|
||||
// or in go-connections.
|
||||
// see: https://github.com/moby/moby/issues/45539
|
||||
transport.MaxIdleConns = 6
|
||||
transport.IdleConnTimeout = 30 * time.Second
|
||||
err := sockets.ConfigureTransport(transport, hostURL.Scheme, hostURL.Host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user