struct IdleProbeBackoff {
cooldown_remaining: u64,
consecutive_failures: u32,
}Expand description
Per-tick gate that throttles UserIdle::get_time() once it starts
failing. While the probe succeeds we attempt it every tick; once it
fails we skip an exponentially-growing number of ticks before retrying,
so a windowing system that rejects the call (X11 without
MIT-SCREEN-SAVER, a denied Wayland portal) doesn’t get hammered — and
re-spammed — once per second.
Fields§
§cooldown_remaining: u64Ticks left to skip before the next probe. 0 means “probe now”.
consecutive_failures: u32Failures since the last success, driving the back-off growth.
Implementations§
Source§impl IdleProbeBackoff
impl IdleProbeBackoff
fn new() -> Self
Sourcefn should_probe(&mut self) -> bool
fn should_probe(&mut self) -> bool
Call once per tick. Returns true if the run loop should probe
this tick; otherwise consumes one tick of the cooldown and returns
false.
Sourcefn record_success(&mut self)
fn record_success(&mut self)
Record a successful probe: clear the failure streak and resume probing every tick.
Sourcefn record_failure(&mut self) -> u64
fn record_failure(&mut self) -> u64
Record a failed probe and schedule the next attempt via exponential back-off. Returns the cooldown (seconds) for the log line.
Auto Trait Implementations§
impl Freeze for IdleProbeBackoff
impl RefUnwindSafe for IdleProbeBackoff
impl Send for IdleProbeBackoff
impl Sync for IdleProbeBackoff
impl Unpin for IdleProbeBackoff
impl UnsafeUnpin for IdleProbeBackoff
impl UnwindSafe for IdleProbeBackoff
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more