Skip to content

Commit

Permalink
Move timer out of the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Sharp authored and Alexey Sharp committed Apr 25, 2022
1 parent 1e22f55 commit 12f123c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions eth/stagedsync/stage_headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,8 @@ func WaitForDownloader(ctx context.Context, tx kv.RwTx, cfg HeadersCfg) error {
// send all hashes to the Downloader service
preverified := snapshotsCfg.Preverified
var prevBytesCompleted uint64
logEvery := time.NewTicker(logInterval)
defer logEvery.Stop()
for _, p := range preverified {
req := &proto_downloader.DownloadRequest{Items: make([]*proto_downloader.DownloadItem, 1)}
req.Items[0] = &proto_downloader.DownloadItem{
Expand All @@ -1201,9 +1203,6 @@ func WaitForDownloader(ctx context.Context, tx kv.RwTx, cfg HeadersCfg) error {
continue
}

logEvery := time.NewTicker(logInterval)
defer logEvery.Stop()

// Print download progress until all segments are available
Loop:
for {
Expand Down

0 comments on commit 12f123c

Please sign in to comment.