Skip to content

Commit

Permalink
metrics: return an empty snapshot for NilResettingTimer (ethereum#16930)
Browse files Browse the repository at this point in the history
  • Loading branch information
nonsense authored and kielbarry committed Jul 9, 2018
1 parent 084137d commit 3f22648
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion metrics/resetting_timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ type NilResettingTimer struct {
func (NilResettingTimer) Values() []int64 { return nil }

// Snapshot is a no-op.
func (NilResettingTimer) Snapshot() ResettingTimer { return NilResettingTimer{} }
func (NilResettingTimer) Snapshot() ResettingTimer {
return &ResettingTimerSnapshot{
values: []int64{},
}
}

// Time is a no-op.
func (NilResettingTimer) Time(func()) {}
Expand Down

0 comments on commit 3f22648

Please sign in to comment.