pub struct RenewalPolicy {
pub renew_at_fraction: f64,
pub jitter_fraction: f64,
pub min_renew_secs: u64,
pub max_backoff_secs: u64,
}Expand description
Controls when a lease should be renewed and how to handle failures.
The manager checks each lease on every tick(). A lease is due for
renewal when:
remaining_ttl <= total_ttl * (1.0 - renew_at_fraction) +/- jitterOn failure, the manager applies exponential backoff up to
max_backoff_secs.
Fields§
§renew_at_fraction: f64Fraction of TTL at which to trigger renewal (default 0.75).
A value of 0.75 means “renew when 75% of the TTL has elapsed” (i.e. 25% remaining).
jitter_fraction: f64Random jitter as a fraction of total TTL (default 0.10).
The actual renewal threshold is shifted by up to this fraction in either direction for stagger.
min_renew_secs: u64Minimum renewal duration in seconds (default 30).
max_backoff_secs: u64Maximum backoff delay in seconds on renewal failure (default 5).
Implementations§
Source§impl RenewalPolicy
impl RenewalPolicy
Sourcepub fn renewal_deadline(
&self,
created_at: u64,
expires_at: u64,
jitter_seed: u64,
) -> u64
pub fn renewal_deadline( &self, created_at: u64, expires_at: u64, jitter_seed: u64, ) -> u64
Compute the absolute unix timestamp at which renewal should fire,
given created_at and expires_at.
jitter_seed is a deterministic value (e.g. lease_id bits) used
to compute jitter without requiring a PRNG.
Trait Implementations§
Source§impl Clone for RenewalPolicy
impl Clone for RenewalPolicy
Source§fn clone(&self) -> RenewalPolicy
fn clone(&self) -> RenewalPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more