configure timeouts for http.Server (#1)
All checks were successful
ci/woodpecker/pr/docker-deploy Pipeline was successful
All checks were successful
ci/woodpecker/pr/docker-deploy Pipeline was successful
This commit is contained in:
parent
d68724a470
commit
a21ebe5af2
1 changed files with 7 additions and 1 deletions
8
main.go
8
main.go
|
@ -20,6 +20,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
"github.com/alecthomas/kingpin/v2"
|
||||||
"github.com/go-kit/log"
|
"github.com/go-kit/log"
|
||||||
|
@ -146,7 +147,12 @@ func main() {
|
||||||
http.Handle("/", landingPage)
|
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 {
|
if err := web.ListenAndServe(srv, toolkitFlags, logger); err != nil {
|
||||||
level.Error(logger).Log("msg", "Error starting HTTP server", "err", err)
|
level.Error(logger).Log("msg", "Error starting HTTP server", "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
Loading…
Reference in a new issue