jitter-backoff 11.2.0

Zero-dependency exponential backoff, full/equal/decorrelated jitter, deadline retry budgets, Retry-After header parsing, and synchronous retry execution.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::*;

/// Lock-free token-ratio retry budget preventing retry storms during cascading outages.
///
/// Each normal request deposits `deposit_permille` credits (e.g. `200` = 20% retry ratio);
/// each retry consumes `1000` credits. A minimum reserve guarantees retries work at low QPS.
#[repr(align(64))]
#[derive(Debug)]
pub struct RetryBudget {
    /// Available retry credits in milli-retries (`1000` = 1 retry).
    pub(crate) tokens: AtomicU64,
    /// Maximum credit capacity (`min_reserve_retries * 1000` or higher).
    pub(crate) max_tokens: u64,
    /// Credits deposited per normal non-retry request (e.g. `200` for 20% ratio).
    pub(crate) deposit_permille: u64,
}