Skip to main content

user_idle_warn_throttle

Function user_idle_warn_throttle 

Source
fn user_idle_warn_throttle(
    cell: &AtomicI64,
    now_epoch: i64,
    min_interval_secs: i64,
) -> bool
Expand description

Decide whether enough time has elapsed since the last UserIdle warn to fire another one, and update the timestamp atomically if so.

Pure (modulo the atomic): inputs are now and the cell, output is just the gate. Split out so the rate-limit logic can be unit-tested without touching log::warn!.