mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/httpserver: add -http.idleConnTimeout
command-line flag for tuning the timeout for incoming idle http connections
This commit is contained in:
parent
a01c56104a
commit
bc1ca4b20b
1 changed files with 2 additions and 1 deletions
|
@ -38,6 +38,7 @@ var (
|
||||||
"Highly loaded server may require increased value for graceful shutdown")
|
"Highly loaded server may require increased value for graceful shutdown")
|
||||||
shutdownDelay = flag.Duration("http.shutdownDelay", 0, "Optional delay before http server shutdown. During this dealy the servier returns non-OK responses "+
|
shutdownDelay = flag.Duration("http.shutdownDelay", 0, "Optional delay before http server shutdown. During this dealy the servier returns non-OK responses "+
|
||||||
"from /health page, so load balancers can route new requests to other servers")
|
"from /health page, so load balancers can route new requests to other servers")
|
||||||
|
idleConnTimeout = flag.Duration("http.idleConnTimeout", time.Minute, "Timeout for incoming idle http connections")
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -100,7 +101,7 @@ func serveWithListener(addr string, ln net.Listener, rh RequestHandler) {
|
||||||
TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler)),
|
TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler)),
|
||||||
|
|
||||||
ReadHeaderTimeout: 5 * time.Second,
|
ReadHeaderTimeout: 5 * time.Second,
|
||||||
IdleTimeout: time.Minute,
|
IdleTimeout: *idleConnTimeout,
|
||||||
|
|
||||||
// Do not set ReadTimeout and WriteTimeout here,
|
// Do not set ReadTimeout and WriteTimeout here,
|
||||||
// since these timeouts must be controlled by request handlers.
|
// since these timeouts must be controlled by request handlers.
|
||||||
|
|
Loading…
Reference in a new issue