Struct client::RetryPolicy
zaun_community_protocol::client::RetryPolicy · Struct
pub struct RetryPolicy { … }Exponential backoff: initial_ms, then ×factor, capped at cap_ms; give up once
give_up_ms have passed since the first send.
A resend also waits until the host has been silent for initial_ms (at most cap_ms
longer): while its messages are still arriving, the answer is most likely among them.
Fields
Section titled “Fields”initial_ms: u64
Section titled “initial_ms: u64”Delay before the first retry.
factor: u64
Section titled “factor: u64”Multiplier per attempt.
cap_ms: u64
Section titled “cap_ms: u64”Largest delay.
give_up_ms: u64
Section titled “give_up_ms: u64”Total time after which a request is abandoned.
Methods
Section titled “Methods”pub fn delay(&self, attempt: u32) -> u64The delay after send number attempt (1 = the first send): 5 s, 10 s, 20 s, 40 s,
then 60 s.
refused_delay
Section titled “refused_delay”pub fn refused_delay(&self, attempt: u32) -> u64The delay after a transient error on send number attempt: 2 s, 4 s, 8 s, … 60 s,
never longer than RetryPolicy::delay.
next_at
Section titled “next_at”pub fn next_at(&self, now_ms: u64, attempt: u32, error: Option<&ErrorBody>) -> u64The next send time after send number attempt at now_ms: the backoff, or after a
transient error its RetryPolicy::refused_delay or, if later, its
retry_after_ms.
resend_now
Section titled “resend_now”pub const fn resend_now(&self, due_ms: u64, heard_ms: Option<u64>, now_ms: u64) -> boolWhether a resend due at due_ms goes out at now_ms, the host last heard at
heard_ms: once the host has been silent for initial_ms, or cap_ms after it was
due, whatever the host is sending.
expired
Section titled “expired”pub const fn expired(&self, first_ms: u64, now_ms: u64) -> boolWhether a request first sent at first_ms is abandoned at now_ms.
Trait implementations
Section titled “Trait implementations”Clone, Copy, Debug, Default, Eq, PartialEq, StructuralPartialEq