pub struct HttpRetryOptions {
pub enabled: bool,
pub max_attempts: u32,
pub max_duration: Option<Duration>,
pub delay_strategy: RetryDelay,
pub jitter_factor: f64,
pub method_policy: HttpRetryMethodPolicy,
pub retry_status_codes: Option<Vec<StatusCode>>,
pub retry_error_kinds: Option<Vec<HttpErrorKind>>,
}Expand description
Retry settings for crate::HttpClient.
Fields§
§enabled: boolWhether built-in retry is enabled.
max_attempts: u32Maximum number of attempts, including the first request.
max_duration: Option<Duration>Optional maximum total retry duration.
delay_strategy: RetryDelayDelay strategy between attempts.
jitter_factor: f64Jitter factor passed to the retry delay strategy.
method_policy: HttpRetryMethodPolicyMethod replay policy.
retry_status_codes: Option<Vec<StatusCode>>Optional retryable status-code allowlist.
When set, only listed statuses are retryable for status errors.
retry_error_kinds: Option<Vec<HttpErrorKind>>Optional retryable error-kind allowlist for non-status failures.
When set, only listed kinds are retryable for non-status errors.
Implementations§
Source§impl HttpRetryOptions
impl HttpRetryOptions
Sourcepub fn from_config<R>(config: &R) -> Result<Self, HttpConfigError>where
R: ConfigReader + ?Sized,
pub fn from_config<R>(config: &R) -> Result<Self, HttpConfigError>where
R: ConfigReader + ?Sized,
Creates HttpRetryOptions from config using relative keys.
§Parameters
config: AnyConfigReaderscoped to the retry section.
§Returns
Parsed retry options or HttpConfigError.
Sourcepub fn validate(&self) -> Result<(), HttpConfigError>
pub fn validate(&self) -> Result<(), HttpConfigError>
Sourcepub fn allows_method(&self, method: &Method) -> bool
pub fn allows_method(&self, method: &Method) -> bool
Sourcepub fn should_retry(&self, request: &HttpRequest) -> bool
pub fn should_retry(&self, request: &HttpRequest) -> bool
Returns whether retry should run for request under this policy.
§Parameters
request: Request whose method is checked against retry policy.
§Returns
true when retry is enabled, max_attempts is greater than one, and
the request method is allowed by Self::method_policy.
Sourcepub fn resolve(&self, request: &HttpRequest) -> Self
pub fn resolve(&self, request: &HttpRequest) -> Self
Sourcepub fn is_retryable_status(&self, status: StatusCode) -> bool
pub fn is_retryable_status(&self, status: StatusCode) -> bool
Sourcepub fn is_retryable_error_kind(&self, kind: HttpErrorKind) -> bool
pub fn is_retryable_error_kind(&self, kind: HttpErrorKind) -> bool
Trait Implementations§
Source§impl Clone for HttpRetryOptions
impl Clone for HttpRetryOptions
Source§fn clone(&self) -> HttpRetryOptions
fn clone(&self) -> HttpRetryOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more