Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

fs/fshttp: limit MaxIdleConns and MaxIdleConnsPerHost

Nick Craig-Wood37be78705db7
diff --git a/fs/fshttp/http.go b/fs/fshttp/http.go
index 9566d58f8..642acbc1e 100644
--- a/fs/fshttp/http.go
+++ b/fs/fshttp/http.go
@@ -126,7 +126,8 @@ func NewTransport(ci *fs.ConfigInfo) http.RoundTripper {
t := new(http.Transport)
setDefaults(t, http.DefaultTransport.(*http.Transport))
t.Proxy = http.ProxyFromEnvironment
- t.MaxIdleConnsPerHost = 4 * (ci.Checkers + ci.Transfers + 1)
+ t.MaxIdleConnsPerHost = 2 * (ci.Checkers + ci.Transfers + 1)
+ t.MaxIdleConns = 2 * t.MaxIdleConnsPerHost
t.TLSHandshakeTimeout = ci.ConnectTimeout
t.ResponseHeaderTimeout = ci.Timeout
t.TLSClientConfig = &tls.Config{InsecureSkipVerify: ci.InsecureSkipVerify}