Skip to main content

periodic_sleep_duration

Function periodic_sleep_duration 

Source
pub fn periodic_sleep_duration(
    base_interval: Duration,
    jitter_cap: Option<Duration>,
) -> Duration
Expand description

Returns a periodic delay with bounded positive jitter.

A zero base interval would hot-spin the runner loop — and, for scheduled tasks, the database — so it is raised to the same one-second floor the dispatch worker enforces in effective_dispatch_base_interval. Non-zero sub-second intervals pass through untouched: they are a deliberate caller choice (fast tests, high-frequency in-memory polls), not the accident this floor guards against.