mirror of
https://github.com/octoleo/restic.git
synced 2024-11-02 19:49:44 +00:00
s3: Increase MaxIdleConnsPerHost
This commit is contained in:
parent
98ae30b513
commit
36dee7d892
@ -3,9 +3,12 @@ package s3
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
"restic"
|
"restic"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"restic/backend"
|
"restic/backend"
|
||||||
"restic/errors"
|
"restic/errors"
|
||||||
@ -36,6 +39,21 @@ func Open(cfg Config) (restic.Backend, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
be := &s3{client: client, bucketname: cfg.Bucket, prefix: cfg.Prefix}
|
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()
|
be.createConnections()
|
||||||
|
|
||||||
found, err := client.BucketExists(cfg.Bucket)
|
found, err := client.BucketExists(cfg.Bucket)
|
||||||
|
Loading…
Reference in New Issue
Block a user