Expand description
Defines the trait for polling backoff policies and a common implementations.
The client libraries can automatically poll long-running operations (LROs) until completion. When doing so they may backoff between polling to avoid overloading the service.
These policies should not be confused with retry backoff policies. Their purpose is different, and their implementation is too. Notably, polling backoff policies should not use jitter, while retry policies should.
The most common implementation is truncated exponential backoff without jitter. The backoff period grows exponentially until some limit is reached. This works well when the expected execution time is not known in advance.
To configure the default polling backoff policy for a client, use ClientBuilder::with_polling_backoff_policy. To configure the polling backoff policy used for a specific request, use RequestOptionsBuilder::with_polling_backoff_policy.
§Example
use std::time::Duration;
let policy = ExponentialBackoffBuilder::new()
.with_initial_delay(Duration::from_millis(100))
.with_maximum_delay(Duration::from_secs(5))
.with_scaling(4.0)
.build()?;
// `policy` implements the `PollingBackoffPolicy` trait.Structs§
- Polling
Backoff Policy Arg - A helper type to use PollingBackoffPolicy in client and request options.
Traits§
- Polling
Backoff Policy - Defines the trait implemented by all backoff strategies.