From 844603ea4eead83c38dc91c5a0322ba04ec9af2c Mon Sep 17 00:00:00 2001 From: Lucca Martins Date: Tue, 25 Feb 2025 15:13:36 -0300 Subject: [PATCH] resolving comments --- consensus/bor/heimdall/client.go | 3 +-- internal/cli/server/config.go | 1 + internal/cli/server/flags.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/consensus/bor/heimdall/client.go b/consensus/bor/heimdall/client.go index 4c21c31fac..0e19aac356 100644 --- a/consensus/bor/heimdall/client.go +++ b/consensus/bor/heimdall/client.go @@ -33,7 +33,6 @@ var ( const ( heimdallAPIBodyLimit = 128 * 1024 * 1024 // 128 MB stateFetchLimit = 50 - retryCall = 5 * time.Second ) type StateSyncEventsResponse struct { @@ -293,7 +292,7 @@ func FetchWithRetry[T any](ctx context.Context, client http.Client, url *url.URL log.Warn("an error while trying fetching from Heimdall", "path", url.Path, "attempt", attempt, "error", err) // create a new ticker for retrying the request - ticker := time.NewTicker(retryCall) + ticker := time.NewTicker(client.Timeout) defer ticker.Stop() const logEach = 5 diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index e870e7dcd5..9d781ed368 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -646,6 +646,7 @@ func DefaultConfig() *Config { }, Heimdall: &HeimdallConfig{ URL: "http://localhost:1317", + Timeout: 5 * time.Second, Without: false, GRPCAddress: "", }, diff --git a/internal/cli/server/flags.go b/internal/cli/server/flags.go index f09bc32fa0..84aafab712 100644 --- a/internal/cli/server/flags.go +++ b/internal/cli/server/flags.go @@ -171,7 +171,7 @@ func (c *Command) Flags(config *Config) *flagset.Flagset { }) f.DurationFlag(&flagset.DurationFlag{ Name: "bor.heimdalltimeout", - Usage: "Timeout of Heimdall service", + Usage: "Timeout period for bor's outgoing requests to heimdall", Value: &c.cliConfig.Heimdall.Timeout, Default: 5 * time.Second, })