mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-16 04:24:56 +02:00
cmd/thalos/server.go: Set context timeout to eos api call.
This commit is contained in:
parent
2382f72e5a
commit
fb62e10667
1 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue