pub struct RetryPolicy {
pub max_attempts: u32,
pub initial_backoff: Duration,
pub max_backoff: Duration,
pub backoff_multiplier: f64,
pub max_elapsed: Option<Duration>,
}Expand description
Agent policy for retrying transient generation failures, discarding failed drafts.
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. A longer provider minimum must stop retries rather than cause an earlier request or an unbounded wait.
backoff_multiplier: f64§max_elapsed: Option<Duration>Optional elapsed recovery budget, starting at the first retryable failure. Includes later waits and requests; the original request has no new deadline.
Implementations§
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 capped computed backoff. Callers must stop if the resulting
minimum exceeds Self::max_backoff or their remaining elapsed budget.
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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more