pub struct RetryPolicy {
pub max_attempts: u32,
pub initial_backoff: Duration,
pub max_backoff: Duration,
pub total_deadline: Duration,
}Expand description
Bounds on a retry sequence.
Two independent limits apply, and whichever trips first wins:
max_attempts caps how many times the work is tried, total_deadline
caps the wall-clock time the whole sequence may consume. The deadline is
what keeps a per-attempt timeout from multiplying — a 600 s send timeout
retried four times must not become a 40-minute hang.
Fields§
§max_attempts: u32Total attempts, including the first. 1 disables retrying.
initial_backoff: DurationBackoff base for the first retry; doubles each subsequent retry.
max_backoff: DurationCeiling on any single delay, including a server-supplied Retry-After.
total_deadline: DurationCeiling on the wall-clock time the whole sequence may consume.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
RetryPolicy::default with any environment overrides applied.
Resolved once per process: these are operator settings, and re-reading them per request would cost a syscall on every completion for a value that cannot meaningfully change mid-run.
An unset or unparseable variable leaves that field at its default — a typo degrades to standard behaviour rather than disabling retry.
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 moreSource§impl Debug for RetryPolicy
impl Debug for RetryPolicy
Source§impl Default for RetryPolicy
impl Default for RetryPolicy
Source§fn default() -> Self
fn default() -> Self
Defaults tuned for the LLM completion path.
Deliberately modest: the proxy already absorbs ModelLoading
server-side, so a client-side retry is covering startup contention,
which by definition means something upstream has already waited a long
time. A larger budget here would stack on top of that and turn an
unlucky request into a multi-minute hang.
Source§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
Source§fn eq(&self, other: &RetryPolicy) -> bool
fn eq(&self, other: &RetryPolicy) -> bool
self and other values to be equal, and is used by ==.