From c127da12194e5b6e8a51d9b51a9ed9700ba9ac0b Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 13 Oct 2020 14:04:46 -0700 Subject: [PATCH] filer: linearize timeout for large chunk of data --- weed/util/net_timeout.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/weed/util/net_timeout.go b/weed/util/net_timeout.go index f057a8f5b..e8075c297 100644 --- a/weed/util/net_timeout.go +++ b/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 }