pub struct RateLimitCache { /* private fields */ }Expand description
The poller-written, status/menu-read rate-limit snapshot cache.
A plain std::Mutex<Option<..>>: writes come from the poll loop, reads from the
status op and the tray menu build. The lock is never held across an .await —
every method takes it, finishes, and drops it. Empty until the first poll lands,
in which case daemon status simply carries no github_rate_limit field.
Implementations§
Source§impl RateLimitCache
impl RateLimitCache
Sourcepub fn get(&self) -> Option<RateLimitSnapshot>
pub fn get(&self) -> Option<RateLimitSnapshot>
The latest snapshot, or None before the first successful poll.
Sourcepub fn replace(&self, next: RateLimitSnapshot) -> bool
pub fn replace(&self, next: RateLimitSnapshot) -> bool
Stores next, returning whether it differs from the previous snapshot — the
caller uses the bool only to decide whether to log a transition, never to
bump the tree change-notify (rate limit is not tree topology).
Sourcepub fn observe_graphql(&self, graphql: RateLimitResource) -> bool
pub fn observe_graphql(&self, graphql: RateLimitResource) -> bool
Folds a graphql budget reading carried by a PR poll (#1389, fix 8) into the
cache, updating only the graphql resource and preserving the core /
search readings from the standalone /rate_limit poller. Returns whether
the snapshot changed.
Every PR poll ships the graphql budget for free (the query’s own rateLimit
block), so this keeps that reading fresh between — or instead of — standalone
polls, which lets the standalone poller idle when nothing is being watched
(fix 8b) without the graphql figure going stale while polling is active.
Trait Implementations§
Source§impl Debug for RateLimitCache
impl Debug for RateLimitCache
Source§impl Default for RateLimitCache
impl Default for RateLimitCache
Source§fn default() -> RateLimitCache
fn default() -> RateLimitCache
Auto Trait Implementations§
impl !Freeze for RateLimitCache
impl RefUnwindSafe for RateLimitCache
impl Send for RateLimitCache
impl Sync for RateLimitCache
impl Unpin for RateLimitCache
impl UnsafeUnpin for RateLimitCache
impl UnwindSafe for RateLimitCache
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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