feat: set global http timeouts except for streaming endpoints

related #411

Release-As: 0.16.2
This commit is contained in:
sentriz
2023-11-18 12:33:36 +00:00
parent dd0f6b3650
commit 2edb1b8eda
3 changed files with 27 additions and 5 deletions

View File

@@ -288,7 +288,11 @@ func main() {
errgrp.Go(func() error {
defer logJob("http")()
server := &http.Server{Addr: *confListenAddr, Handler: mux, ReadHeaderTimeout: 5 * time.Second}
server := &http.Server{
Addr: *confListenAddr,
ReadTimeout: 5 * time.Second, WriteTimeout: 5 * time.Second, IdleTimeout: 5 * time.Second,
Handler: mux,
}
errgrp.Go(func() error {
<-ctx.Done()
return server.Shutdown(context.Background())