MCPcopy Index your code
hub / github.com/InferCore/InferCore / HTTPLayerTimeouts

Function HTTPLayerTimeouts

internal/server/server.go:73–92  ·  view source on GitHub ↗

HTTPLayerTimeouts returns net/http.Server timeouts. If server.http.{read,write,idle}_timeout_ms are > 0, those values are used; otherwise defaults are derived from server.request_timeout_ms (read: infer budget + 2m for body, write: budget + 30s, idle: 2m).

(cfg *config.Config)

Source from the content-addressed store, hash-verified

71// If server.http.{read,write,idle}_timeout_ms are > 0, those values are used; otherwise defaults are
72// derived from server.request_timeout_ms (read: infer budget + 2m for body, write: budget + 30s, idle: 2m).
73func HTTPLayerTimeouts(cfg *config.Config) (read, write, idle time.Duration) {
74 ms := cfg.Server.RequestTimeoutMS
75 if ms <= 0 {
76 ms = 30000
77 }
78 req := time.Duration(ms) * time.Millisecond
79 read = req + 2*time.Minute
80 write = req + 30*time.Second
81 idle = 2 * time.Minute
82 if x := cfg.Server.HTTP.ReadTimeoutMS; x > 0 {
83 read = time.Duration(x) * time.Millisecond
84 }
85 if x := cfg.Server.HTTP.WriteTimeoutMS; x > 0 {
86 write = time.Duration(x) * time.Millisecond
87 }
88 if x := cfg.Server.HTTP.IdleTimeoutMS; x > 0 {
89 idle = time.Duration(x) * time.Millisecond
90 }
91 return read, write, idle
92}
93
94func (s *Server) inferRequestTimeout() time.Duration {
95 if s.cfg.Server.RequestTimeoutMS <= 0 {

Callers 2

serveCmdFunction · 0.92

Calls

no outgoing calls

Tested by 1