pub struct RetryConfig {
pub enabled: bool,
pub max_retries: u32,
pub initial_delay: Duration,
pub max_delay: Duration,
pub max_server_delay: Duration,
pub backoff_multiplier: f32,
}Expand description
Configuration for automatic retry with exponential backoff.
Fields§
§enabled: boolWhether retries are enabled.
max_retries: u32Maximum number of retry attempts before giving up.
initial_delay: DurationInitial delay before the first retry.
max_delay: DurationMaximum exponential backoff delay.
max_server_delay: DurationLargest server-provided delay this executor will wait for. A larger delay returns the original failure without another attempt.
backoff_multiplier: f32Multiplier applied to the delay after each retry.
Implementations§
Source§impl RetryConfig
impl RetryConfig
Sourcepub fn with_max_retries(self, max_retries: u32) -> Self
pub fn with_max_retries(self, max_retries: u32) -> Self
Set the maximum number of retry attempts.
Sourcepub fn with_initial_delay(self, initial_delay: Duration) -> Self
pub fn with_initial_delay(self, initial_delay: Duration) -> Self
Set the initial delay before the first retry.
Sourcepub fn with_max_delay(self, max_delay: Duration) -> Self
pub fn with_max_delay(self, max_delay: Duration) -> Self
Set the maximum exponential backoff delay.
Sourcepub fn with_backoff_multiplier(self, backoff_multiplier: f32) -> Self
pub fn with_backoff_multiplier(self, backoff_multiplier: f32) -> Self
Set the backoff multiplier applied after each retry.
Sourcepub fn with_max_server_delay(self, limit: Duration) -> Self
pub fn with_max_server_delay(self, limit: Duration) -> Self
Set the largest accepted server-provided retry delay.
The default is 60 seconds. A hint above the limit returns the original
error; an accepted hint is never shortened to Self::max_delay.
§Example
use adk_model::retry::RetryConfig;
use std::time::Duration;
let retry = RetryConfig::default().with_max_server_delay(Duration::from_secs(30));
assert_eq!(retry.max_server_delay, Duration::from_secs(30));Trait Implementations§
Source§impl Clone for RetryConfig
impl Clone for RetryConfig
Source§impl Debug for RetryConfig
impl Debug for RetryConfig
Auto Trait Implementations§
impl Forget for RetryConfig
impl Freeze for RetryConfig
impl Move for RetryConfig
impl RefUnwindSafe for RetryConfig
impl Send for RetryConfig
impl Sync for RetryConfig
impl Unpin for RetryConfig
impl UnsafeUnpin for RetryConfig
impl UnwindSafe for RetryConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request