Skip to main content

proxima_core/time/
missed_tick.rs

1//! `MissedTickBehavior` — match tokio's three-way enum for how the
2//! [`Interval`](super::Interval) recovers when a consumer falls behind
3//! the period.
4
5/// What happens when an [`Interval`](super::Interval) consumer skips
6/// past a tick deadline (consumer time exceeded the period). Shape
7/// matches `tokio::time::MissedTickBehavior`.
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
9pub enum MissedTickBehavior {
10    /// Catch up — fire missed ticks back-to-back until the deadline
11    /// converges. Useful for "every tick must run" semantics, but the
12    /// burst can starve other work. Tokio's default.
13    #[default]
14    Burst,
15    /// Delay — anchor the next deadline to (now + period). Drifts
16    /// over time but never bursts. Useful for periodic maintenance
17    /// that should pace from each completion.
18    Delay,
19    /// Skip — anchor the next deadline to (now + period), discarding
20    /// the missed ticks. Useful for "latest tick wins" semantics
21    /// (rate-limit sweepers, health pings). Bounded drift; no burst.
22    Skip,
23}