diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2022-03-15 11:45:03 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-15 11:45:03 -0700 |
| commit | fa6fe327bfe2782427646f54894ed5bddbe412e4 (patch) | |
| tree | a52ebee76e77266917881bfcbc9d5780b199d487 | |
| parent | 2eda3a686ffc1707e67a45ff39c5852f02e5ec7b (diff) | |
| parent | c2e7d663bcb0992da7b29795bd9118c87a890850 (diff) | |
| download | seaweedfs-fa6fe327bfe2782427646f54894ed5bddbe412e4.tar.xz seaweedfs-fa6fe327bfe2782427646f54894ed5bddbe412e4.zip | |
Merge pull request #2756 from kmlebedev/upload_conn_timeout
reduced the timeout for creating a connection from 30 to 10 seconds
| -rw-r--r-- | weed/operation/upload_content.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go index 569a54372..3d41d2eb5 100644 --- a/weed/operation/upload_content.go +++ b/weed/operation/upload_content.go @@ -11,6 +11,7 @@ import ( "io" "mime" "mime/multipart" + "net" "net/http" "net/textproto" "path/filepath" @@ -65,6 +66,10 @@ var ( func init() { HttpClient = &http.Client{Transport: &http.Transport{ + DialContext: (&net.Dialer{ + Timeout: 10 * time.Second, + KeepAlive: 10 * time.Second, + }).DialContext, MaxIdleConns: 1024, MaxIdleConnsPerHost: 1024, }} @@ -261,6 +266,7 @@ func upload_content(fillBufferFunction func(w io.Writer) error, originalDataSize if post_err != nil { if strings.Contains(post_err.Error(), "connection reset by peer") || 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) } } |
