mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
reduced the timeout for creating a connection from 30 to 10 seconds
This commit is contained in:
parent
2eda3a686f
commit
c2e7d663bc
|
@ -11,6 +11,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"mime"
|
"mime"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/textproto"
|
"net/textproto"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -65,6 +66,10 @@ var (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
HttpClient = &http.Client{Transport: &http.Transport{
|
HttpClient = &http.Client{Transport: &http.Transport{
|
||||||
|
DialContext: (&net.Dialer{
|
||||||
|
Timeout: 10 * time.Second,
|
||||||
|
KeepAlive: 10 * time.Second,
|
||||||
|
}).DialContext,
|
||||||
MaxIdleConns: 1024,
|
MaxIdleConns: 1024,
|
||||||
MaxIdleConnsPerHost: 1024,
|
MaxIdleConnsPerHost: 1024,
|
||||||
}}
|
}}
|
||||||
|
@ -261,6 +266,7 @@ func upload_content(fillBufferFunction func(w io.Writer) error, originalDataSize
|
||||||
if post_err != nil {
|
if post_err != nil {
|
||||||
if strings.Contains(post_err.Error(), "connection reset by peer") ||
|
if strings.Contains(post_err.Error(), "connection reset by peer") ||
|
||||||
strings.Contains(post_err.Error(), "use of closed network connection") {
|
strings.Contains(post_err.Error(), "use of closed network connection") {
|
||||||
|
glog.V(1).Infof("repeat error upload request %s: %v", option.UploadUrl, postErr)
|
||||||
resp, post_err = HttpClient.Do(req)
|
resp, post_err = HttpClient.Do(req)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue