Compare commits

..

2 commits

Author SHA1 Message Date
dcc11fca09 Merge pull request 'configure timeouts for http.Server' (#3) from feature-http-timeouts into main, closes #2
Reviewed-on: #3
2024-04-18 11:22:57 +02:00
a21ebe5af2
configure timeouts for http.Server (#1)
All checks were successful
ci/woodpecker/pr/docker-deploy Pipeline was successful
2024-04-18 11:10:56 +02:00

View file

@ -20,6 +20,7 @@ import (
"net/http"
"net/netip"
"os"
"time"
"github.com/alecthomas/kingpin/v2"
"github.com/go-kit/log"
@ -146,7 +147,12 @@ func main() {
http.Handle("/", landingPage)
}
srv := &http.Server{}
srv := &http.Server{
ReadHeaderTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 30 * time.Second,
}
if err := web.ListenAndServe(srv, toolkitFlags, logger); err != nil {
level.Error(logger).Log("msg", "Error starting HTTP server", "err", err)
os.Exit(1)