Add more timeouts

This commit is contained in:
Geoff Stuart
2022-11-25 16:24:09 -05:00
parent b55e121642
commit d2b7c3889b
5 changed files with 10 additions and 5 deletions
+3 -1
View File
@@ -9,6 +9,7 @@ import (
_ "net/http/pprof"
"runtime"
"strconv"
"time"
"github.com/google/uuid"
"github.com/gorilla/mux"
@@ -51,7 +52,8 @@ func ServeRPC(h http.Handler, id string, addr multiaddr.Multiaddr) (StopFunc, er
// Instantiate the server and start listening.
srv := &http.Server{
Handler: h,
Handler: h,
ReadHeaderTimeout: 3 * time.Second,
BaseContext: func(listener net.Listener) context.Context {
ctx, _ := tag.New(context.Background(), tag.Upsert(metrics.APIInterface, id))
return ctx