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.