pub struct PollSchedule { /* private fields */ }Expand description
The bounded, budget-aware poll interval.
§The floor is a rate-budget constraint, not a preference
RefreshInterval refuses anything under 30 seconds at construction, and
every delay this type produces is at least that — including the ones it
computes from a remote header. A rate limit may only ever make this loop
slower.
§retry_delay is an absolute floor, not an addend
c3 documents RefreshState::retry_delay as “the earliest time a retry
may occur”: the scheduling rule is next_attempt_at = now + retry_delay,
and not the ordinary interval plus it. Adding the two compounds on every
successive retry — each new answer carries the remaining window, so an
addend ratchets outward — and the symptom is a dashboard that stays dark
long after GitHub said it could come back, which reads as a hang rather than
as a rate limit. So the two are combined with max, which is what makes the
floor a floor.
Implementations§
Source§impl PollSchedule
impl PollSchedule
pub const fn new(interval: RefreshInterval) -> Self
pub const fn interval(&self) -> RefreshInterval
Sourcepub const fn consecutive_offline(&self) -> u32
pub const fn consecutive_offline(&self) -> u32
The unbroken run of offline polls this schedule has seen.
Sourcepub fn offline_for(&self, now: Timestamp) -> Option<Duration>
pub fn offline_for(&self, now: Timestamp) -> Option<Duration>
How long GitHub has been unreachable, or None when it is not.
Measured from the first poll of the current run rather than inferred
from Self::consecutive_offline times the interval. The two diverge
as soon as the back-off starts doubling, and this is the number the
24-hour queue-cancellation warning is compared against — an estimate
would make that warning fire early or late, and it is the one thing the
offline state exists to say.
Sourcepub fn next_poll(
&mut self,
failure: Option<&RefreshState>,
now: Timestamp,
jitter: &dyn Jitter,
) -> NextPoll
pub fn next_poll( &mut self, failure: Option<&RefreshState>, now: Timestamp, jitter: &dyn Jitter, ) -> NextPoll
Decide when to poll next, given how this pass ended.
failure is the most severe failure across the targets polled this pass,
or None when every target answered. A pass that answered resets the
offline run, which is the whole of “recovery needs no bookkeeping”:
demand is recomputed from the current queued-run set on every poll, so
there is nothing else to unwind.
Trait Implementations§
Source§impl Clone for PollSchedule
impl Clone for PollSchedule
Source§fn clone(&self) -> PollSchedule
fn clone(&self) -> PollSchedule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more