Skip to content

Commit

Permalink
add benchmark to refetch cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
MonikaCat committed Sep 19, 2023
1 parent ca4e608 commit d08a12d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/parse/blocks/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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++ {
Expand All @@ -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
},
}
Expand Down

0 comments on commit d08a12d

Please sign in to comment.