pub struct RetryPolicy {
pub max_attempts: usize,
pub initial_interval: Duration,
pub backoff_factor: f64,
pub max_interval: Duration,
pub jitter: bool,
pub retry_on: Option<RetryPredicate>,
}Expand description
Retry policy for node execution.
Fields§
§max_attempts: usizeMaximum number of attempts (including first try)
initial_interval: DurationInitial delay between retries
backoff_factor: f64Multiplicative backoff factor
max_interval: DurationMaximum delay between retries
jitter: boolWhether to add random jitter to delays
retry_on: Option<RetryPredicate>Optional predicate to determine if an error is retryable
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
pub fn new() -> Self
pub fn with_max_attempts(self, n: usize) -> Self
pub fn with_initial_interval(self, d: Duration) -> Self
pub fn with_backoff_factor(self, f: f64) -> Self
pub fn with_max_interval(self, d: Duration) -> Self
pub fn with_jitter(self, jitter: bool) -> Self
pub fn with_retry_on( self, predicate: impl Fn(&AgentGraphError) -> bool + Send + Sync + 'static, ) -> Self
Sourcepub fn should_retry(&self, error: &AgentGraphError) -> bool
pub fn should_retry(&self, error: &AgentGraphError) -> bool
Check if a given error should be retried
Sourcepub fn delay_for_attempt(&self, attempt: usize) -> Duration
pub fn delay_for_attempt(&self, attempt: usize) -> Duration
Calculate delay for a given attempt number (0-indexed)
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 !RefUnwindSafe for RetryPolicy
impl !UnwindSafe for RetryPolicy
impl Freeze for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnsafeUnpin 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