Struct aws_smithy_client::retry::Config
source · pub struct Config { /* private fields */ }
Expand description
Retry Policy Configuration
Without specific use cases, users should generally rely on the default values set
by Config::default
.
Currently these fields are private and no setters provided. As needed, this configuration will become user-modifiable in the future.
Implementations§
source§impl Config
impl Config
sourcepub fn with_base(self, base: fn() -> f64) -> Self
pub fn with_base(self, base: fn() -> f64) -> Self
Override b
in the exponential backoff computation
By default, base
is a randomly generated value between 0 and 1. In tests, it can
be helpful to override this:
use aws_smithy_client::retry::Config;
let conf = Config::default().with_base(||1_f64);
sourcepub fn with_max_attempts(self, max_attempts: u32) -> Self
pub fn with_max_attempts(self, max_attempts: u32) -> Self
Override the maximum number of attempts
max_attempts
must be set to a value of at least 1
(indicating that retries are disabled).
sourcepub fn with_initial_backoff(self, initial_backoff: Duration) -> Self
pub fn with_initial_backoff(self, initial_backoff: Duration) -> Self
Override the default backoff multiplier of 1 second.
Example
For a request that gets retried 3 times, when initial_backoff is 1 second:
- the first retry will occur after 0 to 1 seconds
- the second retry will occur after 0 to 2 seconds
- the third retry will occur after 0 to 4 seconds
For a request that gets retried 3 times, when initial_backoff is 30 milliseconds:
- the first retry will occur after 0 to 30 milliseconds
- the second retry will occur after 0 to 60 milliseconds
- the third retry will occur after 0 to 120 milliseconds