From 5b1e4c021dcad63b1b43edd8f2a1ced67f9f18a1 Mon Sep 17 00:00:00 2001 From: qianyong Date: Tue, 12 Oct 2021 22:24:10 +0800 Subject: [PATCH] Adjust the read and write timeout configuration of the http server so that the dashboard can work normally in a slow network environment. --- api/internal/core/server/http.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/internal/core/server/http.go b/api/internal/core/server/http.go index 53a4216174..861606da6b 100644 --- a/api/internal/core/server/http.go +++ b/api/internal/core/server/http.go @@ -50,8 +50,8 @@ func (s *server) setupAPI() { s.server = &http.Server{ Addr: addr, Handler: r, - ReadTimeout: time.Duration(1000) * time.Millisecond, - WriteTimeout: time.Duration(5000) * time.Millisecond, + ReadTimeout: time.Duration(5000) * time.Millisecond, + WriteTimeout: time.Duration(60000) * time.Millisecond, } // HTTPS @@ -60,8 +60,8 @@ func (s *server) setupAPI() { s.serverSSL = &http.Server{ Addr: addrSSL, Handler: r, - ReadTimeout: time.Duration(1000) * time.Millisecond, - WriteTimeout: time.Duration(5000) * time.Millisecond, + ReadTimeout: time.Duration(5000) * time.Millisecond, + WriteTimeout: time.Duration(60000) * time.Millisecond, TLSConfig: &tls.Config{ // Causes servers to use Go's default ciphersuite preferences, // which are tuned to avoid attacks. Does nothing on clients.