pub struct RetryPolicy {
pub max_retries: u32,
pub base_delay_ms: u64,
pub max_delay_ms: u64,
pub multiplier: f64,
}Expand description
Retry/backoff policy configuration.
LLM-centric guidance:
- Useful when downstream model APIs (OpenAI, Anthropic, Ollama, etc.) return transient failures like HTTP 429 (rate limit), 408 (timeout), or 5xx. Your worker can NACK the message to reschedule it with a computed delay based on this policy.
- Combine with an appropriate visibility timeout so only one worker attempts a long-running generation at a time.
- After
max_retries, messages are dead-lettered toinfraqueue:{topic}:dlqfor manual inspection.
Fields:
max_retries: reschedules allowed before dead-letter.base_delay_ms: initial delay on first failure.max_delay_ms: upper bound for any backoff delay.multiplier: exponential growth factor (e.g., 2.0 doubles each attempt).
Fields§
§max_retries: u32§base_delay_ms: u64§max_delay_ms: u64§multiplier: f64Implementations§
Source§impl RetryPolicy
impl RetryPolicy
pub fn backoff_delay_ms(&self, retry_count: u32) -> u64
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 moreSource§impl Debug for RetryPolicy
impl Debug 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