From 3657810695edc8a8c52a05d8280c0ade4c1e0c1a Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Tue, 22 Apr 2025 16:20:43 +0800 Subject: [PATCH] cleanup --- eth/downloader/resultstore.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/eth/downloader/resultstore.go b/eth/downloader/resultstore.go index 58c36da940..629fe3a083 100644 --- a/eth/downloader/resultstore.go +++ b/eth/downloader/resultstore.go @@ -42,9 +42,11 @@ type resultStore struct { // this index. throttleThreshold uint64 - lock sync.RWMutex - + // pendingCount is the current number of in-flight block body retrievals + // contained in items. pendingCount int + + lock sync.RWMutex } func newResultStore(size int) *resultStore { @@ -177,11 +179,7 @@ func (r *resultStore) GetCompleted(limit int) []*fetchResult { for i := 0; i < limit; i++ { totalSize += r.items[i].Size() } - if limit > 0 { - blockSizeGauge.Update(int64(totalSize / limit)) - r.pendingCount -= limit - } - + r.pendingCount -= limit pendingBodyGauge.Update(int64(r.pendingCount)) results := make([]*fetchResult, limit)