eth/protocols/snap: fix metrics

This commit is contained in:
Gary Rong 2025-07-23 14:48:31 +08:00
parent 17e016fc57
commit 468cf823bb

View file

@ -689,11 +689,12 @@ func (s *Syncer) Sync(root common.Hash, cancel chan struct{}) error {
if len(s.tasks) == 0 && s.healer.scheduler.Pending() == 0 { if len(s.tasks) == 0 && s.healer.scheduler.Pending() == 0 {
// State healing phase completed, record the elapsed time in metrics. // State healing phase completed, record the elapsed time in metrics.
// Note: healing may be rerun in subsequent cycles to fill gaps between // Note: healing may be rerun in subsequent cycles to fill gaps between
// pivot states (e.g., if chain sync takes longer). The initial healing // pivot states (e.g., if chain sync takes longer).
// phase is more important for us. if !s.healStartTime.IsZero() {
stateHealTimeResettingTimer.Update(time.Since(s.healStartTime)) stateHealTimeResettingTimer.Update(time.Since(s.healStartTime))
log.Info("State healing phase is completed", "elapsed", common.PrettyDuration(time.Since(s.healStartTime))) log.Info("State healing phase is completed", "elapsed", common.PrettyDuration(time.Since(s.healStartTime)))
s.healStartTime = time.Time{} // zero the start time s.healStartTime = time.Time{}
}
return nil return nil
} }
// Assign all the data retrieval tasks to any free peers // Assign all the data retrieval tasks to any free peers