From 67bb45043b0df43bf2fa86444be9a276db7d0591 Mon Sep 17 00:00:00 2001 From: Dmytro Vovk Date: Sun, 5 Jan 2025 19:15:05 +0000 Subject: [PATCH 1/3] sav --- erigon-lib/downloader/downloader.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erigon-lib/downloader/downloader.go b/erigon-lib/downloader/downloader.go index 22e40c13eaa..c06b7256073 100644 --- a/erigon-lib/downloader/downloader.go +++ b/erigon-lib/downloader/downloader.go @@ -1973,6 +1973,14 @@ func (d *Downloader) ReCalcStats(interval time.Duration) { stats.BytesDownload = uint64(connStats.BytesReadData.Int64()) stats.BytesCompleted = uint64(connStats.BytesCompleted.Int64()) + if prevStats.BytesDownload == 0 { + prevStats.BytesDownload = stats.BytesDownload + } + + if prevStats.BytesCompleted == 0 { + prevStats.BytesCompleted = stats.BytesCompleted + } + lastMetadataReady := stats.MetadataReady stats.BytesTotal, stats.ConnectionsTotal, stats.MetadataReady = 0, 0, 0 From 83fd28048e848572f632d90177338d6e8095c730 Mon Sep 17 00:00:00 2001 From: Dmytro Vovk Date: Sun, 5 Jan 2025 19:51:32 +0000 Subject: [PATCH 2/3] save --- erigon-lib/downloader/downloader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erigon-lib/downloader/downloader.go b/erigon-lib/downloader/downloader.go index c06b7256073..27fa55c51e7 100644 --- a/erigon-lib/downloader/downloader.go +++ b/erigon-lib/downloader/downloader.go @@ -1974,7 +1974,7 @@ func (d *Downloader) ReCalcStats(interval time.Duration) { stats.BytesCompleted = uint64(connStats.BytesCompleted.Int64()) if prevStats.BytesDownload == 0 { - prevStats.BytesDownload = stats.BytesDownload + prevStats.BytesDownload = stats.BytesCompleted } if prevStats.BytesCompleted == 0 { From c12308f0c08a7817134e90ef64ea4fc3268aa828 Mon Sep 17 00:00:00 2001 From: Dmytro Vovk Date: Mon, 6 Jan 2025 08:14:35 +0000 Subject: [PATCH 3/3] save --- erigon-lib/downloader/downloader.go | 1 + 1 file changed, 1 insertion(+) diff --git a/erigon-lib/downloader/downloader.go b/erigon-lib/downloader/downloader.go index 27fa55c51e7..5b19cb89495 100644 --- a/erigon-lib/downloader/downloader.go +++ b/erigon-lib/downloader/downloader.go @@ -1973,6 +1973,7 @@ func (d *Downloader) ReCalcStats(interval time.Duration) { stats.BytesDownload = uint64(connStats.BytesReadData.Int64()) stats.BytesCompleted = uint64(connStats.BytesCompleted.Int64()) + // if we have no previous stats, it means that node was restarted and need to set initial values if prevStats.BytesDownload == 0 { prevStats.BytesDownload = stats.BytesCompleted }