2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-23 03:18:55 +00:00

s3: Increase MaxIdleConnsPerHost

This commit is contained in:
Alexander Neumann 2017-02-10 19:24:54 +01:00
parent 98ae30b513
commit 36dee7d892

View File

@ -3,9 +3,12 @@ package s3
import (
"bytes"
"io"
"net"
"net/http"
"path"
"restic"
"strings"
"time"
"restic/backend"
"restic/errors"
@ -36,6 +39,21 @@ func Open(cfg Config) (restic.Backend, error) {
}
be := &s3{client: client, bucketname: cfg.Bucket, prefix: cfg.Prefix}
t := &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
MaxIdleConns: 100,
MaxIdleConnsPerHost: 30,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}
client.SetCustomTransport(t)
be.createConnections()
found, err := client.BucketExists(cfg.Bucket)