From fb62e106675d6f556c0406384a2cf56ab480e482 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sun, 18 Feb 2024 20:06:51 +0100 Subject: [PATCH] cmd/thalos/server.go: Set context timeout to eos api call. --- cmd/thalos/server.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/thalos/server.go b/cmd/thalos/server.go index 65d04ec..41f87b7 100644 --- a/cmd/thalos/server.go +++ b/cmd/thalos/server.go @@ -247,7 +247,10 @@ func chainInfoOnce(api *eos.API) func() *eos.InfoResp { log.WithField("api", api.BaseURL).Info("Get chain info from api") - result, err := api.GetInfo(context.Background()) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) + defer cancel() + + result, err := api.GetInfo(ctx) if err != nil { log.WithError(err).Fatal("Failed to call eos api") return nil