This commit is contained in:
Jared Wasinger 2025-04-22 16:20:43 +08:00
parent aa65601146
commit 3657810695

View file

@ -42,9 +42,11 @@ type resultStore struct {
// this index. // this index.
throttleThreshold uint64 throttleThreshold uint64
lock sync.RWMutex // pendingCount is the current number of in-flight block body retrievals
// contained in items.
pendingCount int pendingCount int
lock sync.RWMutex
} }
func newResultStore(size int) *resultStore { func newResultStore(size int) *resultStore {
@ -177,11 +179,7 @@ func (r *resultStore) GetCompleted(limit int) []*fetchResult {
for i := 0; i < limit; i++ { for i := 0; i < limit; i++ {
totalSize += r.items[i].Size() totalSize += r.items[i].Size()
} }
if limit > 0 { r.pendingCount -= limit
blockSizeGauge.Update(int64(totalSize / limit))
r.pendingCount -= limit
}
pendingBodyGauge.Update(int64(r.pendingCount)) pendingBodyGauge.Update(int64(r.pendingCount))
results := make([]*fetchResult, limit) results := make([]*fetchResult, limit)