From d08a12d88013539d01901e24c8a58d2b61dc41ea Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Tue, 19 Sep 2023 17:22:58 +0700 Subject: [PATCH] add benchmark to refetch cmd --- cmd/parse/blocks/blocks.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/parse/blocks/blocks.go b/cmd/parse/blocks/blocks.go index b8f0a0fb..ebfcd866 100644 --- a/cmd/parse/blocks/blocks.go +++ b/cmd/parse/blocks/blocks.go @@ -2,6 +2,7 @@ package blocks import ( "fmt" + "time" parsecmdtypes "github.com/forbole/juno/v4/cmd/parse/types" "github.com/forbole/juno/v4/types/utils" @@ -67,6 +68,8 @@ will be replaced with the data downloaded from the node. endHeight = end } + testStartTime := time.Now() + log.Info().Int64("start height", startHeight).Int64("end height", endHeight). Msg("getting blocks and transactions") for k := startHeight; k <= endHeight; k++ { @@ -80,7 +83,9 @@ will be replaced with the data downloaded from the node. return fmt.Errorf("error while re-fetching block %d: %s", k, err) } } - + elapsed := time.Since(testStartTime).Seconds() + log.Info().Int64("end height", endHeight).Float64("elapsed", elapsed). + Msg("***** Finished refetching missing blocks **********") return nil }, }