Browse Source

filer: linearize timeout for large chunk of data

pull/1537/head
Chris Lu 4 years ago
parent
commit
c127da1219
  1. 3
      weed/util/net_timeout.go

3
weed/util/net_timeout.go

@ -54,7 +54,8 @@ func (c *Conn) Read(b []byte) (count int, e error) {
func (c *Conn) Write(b []byte) (count int, e error) {
if c.WriteTimeout != 0 {
err := c.Conn.SetWriteDeadline(time.Now().Add(c.WriteTimeout))
// minimum 4KB/s
err := c.Conn.SetWriteDeadline(time.Now().Add(c.WriteTimeout * time.Duration(len(b)/40000+1)))
if err != nil {
return 0, err
}

Loading…
Cancel
Save