fix(stats): expire backdated events from rolling time windows

This commit is contained in:
Nils Andreas Svee committed 2026-10-03 22:29:42 +07:00
1 parent 48a50d7f3a
commit edff75e55a
5 files changed
+90 -23

No files matched your search

+3 -4
View File
@@ -118,10 +118,9 @@ pub(crate) fn normalize_event(event: &ClientEvent) -> Option<StatsEvent> {
// `timeout_at` is anchored to the pre-send probe timestamp (see
// irtt-client's AGENTS.md), so it can precede this same probe's
// own post-send `sent_at` when a probe_timeout is small relative
// to the send-call duration. Rolling-window eviction assumes
// events are pushed in non-decreasing `at()` order, so clamp to
// `sent_at` to preserve that invariant without changing the
// public `timeout_at` value on the event itself.
// to the send-call duration. Clamp to `sent_at` so the loss is
// not earlier than its own send. Delayed timeout discovery can
// still put it before other probes' events.
at: (*timeout_at).max(sent_at.mono),
}),
ClientEvent::Warning { at, .. } => Some(StatsEvent::Warning { at: at.mono }),