pub struct RetryPolicy {
pub max_attempts: u32,
pub initial_backoff: Duration,
pub max_backoff: Duration,
pub backoff_multiplier: f64,
}Expand description
Agent policy for retrying transient failures before any response parts arrive.
Resolved from [gateways.NAME.retry] or [models.KEY.retry].
Fields§
§max_attempts: u32Total attempts including the first. 1 disables retry.
initial_backoff: Duration§max_backoff: DurationCeiling on one wait, applied to a provider’s Retry-After too, so a
hostile or mistaken header cannot park an unattended run for hours.
backoff_multiplier: f64Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn backoff(&self, attempt: u32, retry_after: Option<Duration>) -> Duration
pub fn backoff(&self, attempt: u32, retry_after: Option<Duration>) -> Duration
Wait before attempt (1-based). Attempt 1 is the original send and
never waits; retry_after is the provider’s ask, honoured when it
exceeds the computed backoff and still capped by Self::max_backoff.
No jitter: myco is one client per user, so there is no fleet to de-synchronise, and a deterministic schedule is one less thing to reason about when reading an overnight log.
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RetryPolicy
Source§impl Debug for RetryPolicy
impl Debug for RetryPolicy
Source§impl Default for RetryPolicy
impl Default for RetryPolicy
Source§impl<'de> Deserialize<'de> for RetryPolicy
impl<'de> Deserialize<'de> for RetryPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
Source§fn eq(&self, other: &RetryPolicy) -> bool
fn eq(&self, other: &RetryPolicy) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for RetryPolicy
impl Serialize for RetryPolicy
impl StructuralPartialEq for RetryPolicy
Auto Trait Implementations§
impl Freeze for RetryPolicy
impl RefUnwindSafe for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnsafeUnpin for RetryPolicy
impl UnwindSafe for RetryPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more