Add more timeouts
This commit is contained in:
parent
b55e121642
commit
d2b7c3889b
@ -6,6 +6,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gbrlsnchs/jwt/v3"
|
"github.com/gbrlsnchs/jwt/v3"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
@ -240,7 +241,8 @@ var runCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Handler: handler,
|
Handler: handler,
|
||||||
|
ReadHeaderTimeout: 3 * time.Second,
|
||||||
BaseContext: func(listener net.Listener) context.Context {
|
BaseContext: func(listener net.Listener) context.Context {
|
||||||
ctx, _ := tag.New(context.Background(), tag.Upsert(metrics.APIInterface, "lotus-wallet"))
|
ctx, _ := tag.New(context.Background(), tag.Upsert(metrics.APIInterface, "lotus-wallet"))
|
||||||
return ctx
|
return ctx
|
||||||
|
@ -563,7 +563,8 @@ var runCmd = &cli.Command{
|
|||||||
log.Info("Setting up control endpoint at " + address)
|
log.Info("Setting up control endpoint at " + address)
|
||||||
|
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Handler: sealworker.WorkerHandler(nodeApi.AuthVerify, remoteHandler, workerApi, true),
|
Handler: sealworker.WorkerHandler(nodeApi.AuthVerify, remoteHandler, workerApi, true),
|
||||||
|
ReadHeaderTimeout: 3 * time.Second,
|
||||||
BaseContext: func(listener net.Listener) context.Context {
|
BaseContext: func(listener net.Listener) context.Context {
|
||||||
ctx, _ := tag.New(context.Background(), tag.Upsert(metrics.APIInterface, "lotus-worker"))
|
ctx, _ := tag.New(context.Background(), tag.Upsert(metrics.APIInterface, "lotus-worker"))
|
||||||
return ctx
|
return ctx
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/gorilla/mux"
|
"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.
|
// Instantiate the server and start listening.
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Handler: h,
|
Handler: h,
|
||||||
|
ReadHeaderTimeout: 3 * time.Second,
|
||||||
BaseContext: func(listener net.Listener) context.Context {
|
BaseContext: func(listener net.Listener) context.Context {
|
||||||
ctx, _ := tag.New(context.Background(), tag.Upsert(metrics.APIInterface, id))
|
ctx, _ := tag.New(context.Background(), tag.Upsert(metrics.APIInterface, id))
|
||||||
return ctx
|
return ctx
|
||||||
|
@ -182,7 +182,7 @@ func startFullNodeAPIServer(t *TestEnvironment, repo repo.Repo, napi api.FullNod
|
|||||||
Next: mux.ServeHTTP,
|
Next: mux.ServeHTTP,
|
||||||
}
|
}
|
||||||
|
|
||||||
srv := &http.Server{Handler: ah}
|
srv := &http.Server{Handler: ah, ReadHeaderTimeout: 3 * time.Second}
|
||||||
|
|
||||||
endpoint, err := repo.APIEndpoint()
|
endpoint, err := repo.APIEndpoint()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -638,7 +638,7 @@ func startStorageMinerAPIServer(t *TestEnvironment, repo repo.Repo, minerApi api
|
|||||||
return nil, fmt.Errorf("no API endpoint in repo: %w", err)
|
return nil, fmt.Errorf("no API endpoint in repo: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
srv := &http.Server{Handler: ah}
|
srv := &http.Server{Handler: ah, ReadHeaderTimeout: 3 * time.Second}
|
||||||
|
|
||||||
listenAddr, err := startServer(endpoint, srv)
|
listenAddr, err := startServer(endpoint, srv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user