Skip to main content

Watchdog

Struct Watchdog 

Source
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

Source

pub fn new(retries: Retries, run: RunId) -> Watchdog

Source

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.

Source

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.

Source

pub fn on_provider_answered(&mut self)

The provider answered, which ends the streak of failures.

Source

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.

Trait Implementations§

Source§

impl Debug for Watchdog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Watchdog

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.