pub struct Watchdog { /* private fields */ }Expand description
One watchdog per run: it holds the correction history and the ceiling the person set on retries, nothing else.
Implementations§
Source§impl Watchdog
impl Watchdog
pub fn new(retries: Retries, run: RunId) -> Watchdog
Sourcepub fn on_stall(&mut self, verdict: &StallVerdict) -> Disposal
pub fn on_stall(&mut self, verdict: &StallVerdict) -> Disposal
Consumes the stall verdict verbatim. First hit: a corrective steer naming the repetition. Second hit: freeze.
Sourcepub fn on_provider_failure(
&mut self,
failure: &AxError,
now: TimeMs,
) -> Disposal
pub fn on_provider_failure( &mut self, failure: &AxError, now: TimeMs, ) -> Disposal
Classifies one provider failure. The producer of the error
already decided whether the same call is worth making again, so
this reads AxError::retry rather than guessing a second time.
Retry::No freezes on the first one: repeating a request the
provider rejected on its shape buys the same rejection again.
Yes and Unknown back off (a model call’s only effect is an
answer the city never received) from now by the
schedule Watchdog::backoff_ms owns, or by the provider’s own
retry_after_ms when that is longer: asking before the time it
named buys one more refusal.
A retriable failure freezes only against a ceiling the person
set. Under Retries::UntilHalted what stops a run that keeps
failing is Halt, the city’s one brake; under
Retries::AtMost it is the number they entered, because a
number entered on a form that nothing reads is worse than no
field at all.
Sourcepub fn on_provider_answered(&mut self)
pub fn on_provider_answered(&mut self)
The provider answered, which ends the streak of failures.
Sourcepub fn fired_payload(&self, disposal: &Disposal) -> Result<Payload, AxError>
pub fn fired_payload(&self, disposal: &Disposal) -> Result<Payload, AxError>
The watchdog_fired payload (E_LOOP_SUSPECTED’s carrier when the
reason is a stall). Proceed never fires.
§Errors
E_INVALID_ARGS for Disposal::Proceed, which records
nothing, and whatever Payload::of says about the encoding.