From e2267a1b556d27ffa650aa4d2cc3ccf1f671cccb Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 6 Nov 2023 10:17:58 -0800 Subject: [PATCH] fix: explain why we ignore small time deltas --- sweeper.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sweeper.go b/sweeper.go index 399eabb..0107ff5 100644 --- a/sweeper.go +++ b/sweeper.go @@ -107,6 +107,12 @@ func (sw *sweeper) update() { } return } else if tdiff <= ewmaRate/10 { + // If the time-delta is too small, wait a bit. Otherwise, we can end up logging a + // very large spike. + // + // This won't fix the case where a user passes a large update (spanning multiple + // seconds) to `Meter.Mark`, but it will fix the case where the system fails to + // accurately schedule the sweeper goroutine. return }