From d9ebe42c801eee77c2214cceb9e44b656b8aa7fc Mon Sep 17 00:00:00 2001 From: Vegard Stikbakke Date: Mon, 1 Jul 2024 10:31:49 +0200 Subject: [PATCH] Remove duplicate default poll interval --- client/jsonrpc/client.go | 2 +- ingester/ingester.go | 4 ---- ingester/mainloop.go | 4 +++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/client/jsonrpc/client.go b/client/jsonrpc/client.go index 5069d8c..37bae2f 100644 --- a/client/jsonrpc/client.go +++ b/client/jsonrpc/client.go @@ -64,7 +64,7 @@ func NewClient(log *slog.Logger, cfg Config) (*rpcClient, error) { // revive:dis }, httpHeaders: cfg.HTTPHeaders, } - // lets validate RPC node is up & reachable + // Ensure RPC node is up & reachable _, err := rpc.LatestBlockNumber() if err != nil { return nil, fmt.Errorf("failed to connect to jsonrpc: %w", err) diff --git a/ingester/ingester.go b/ingester/ingester.go index 378b095..9754453 100644 --- a/ingester/ingester.go +++ b/ingester/ingester.go @@ -39,7 +39,6 @@ type Ingester interface { const ( defaultMaxBatchSize = 5 - defaultPollInterval = 1 * time.Second defaultReportProgressInterval = 30 * time.Second ) @@ -119,9 +118,6 @@ func New( cfg: cfg, info: info, } - if ing.cfg.PollInterval == 0 { - ing.cfg.PollInterval = defaultPollInterval - } if ing.cfg.ReportProgressInterval == 0 { ing.cfg.ReportProgressInterval = defaultReportProgressInterval } diff --git a/ingester/mainloop.go b/ingester/mainloop.go index 2bfa858..509496b 100644 --- a/ingester/mainloop.go +++ b/ingester/mainloop.go @@ -82,7 +82,9 @@ func (i *ingester) ProduceBlockNumbers( return latestBlockNumber case <-time.After(i.cfg.PollInterval): } - i.log.Debug(fmt.Sprintf("Waiting %v for block to be available..", i.cfg.PollInterval), + i.log.Debug( + "Waiting for block to be available", + "waitTime", i.cfg.PollInterval.String(), "blockNumber", blockNumber, "latestBlockNumber", latestBlockNumber, )