pub struct CappedExponentialBackoff {
pub max_times: Option<usize>,
pub base_duration: Duration,
pub max_interval: Duration,
}Expand description
自定义的指数退避重试策略,支持最大间隔限制
重试间隔按照指数增长,但不会超过 max_interval
- 第 1 次重试:base_duration × 2^0
- 第 2 次重试:base_duration × 2^1
- …
- 第 n 次重试:min(base_duration × 2^(n-1), max_interval)
Fields§
§max_times: Option<usize>最大重试次数,None 表示无限制
base_duration: Duration基础延迟时间(第一次重试前的等待时间)
max_interval: Duration最大延迟间隔(重试间隔不会超过这个值)
Implementations§
Trait Implementations§
Source§impl Clone for CappedExponentialBackoff
impl Clone for CappedExponentialBackoff
Source§fn clone(&self) -> CappedExponentialBackoff
fn clone(&self) -> CappedExponentialBackoff
Returns a duplicate of the value. Read more
1.0.0 · 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 CappedExponentialBackoff
impl Debug for CappedExponentialBackoff
Source§impl Default for CappedExponentialBackoff
impl Default for CappedExponentialBackoff
Auto Trait Implementations§
impl Freeze for CappedExponentialBackoff
impl RefUnwindSafe for CappedExponentialBackoff
impl Send for CappedExponentialBackoff
impl Sync for CappedExponentialBackoff
impl Unpin for CappedExponentialBackoff
impl UnsafeUnpin for CappedExponentialBackoff
impl UnwindSafe for CappedExponentialBackoff
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