Skip to main content

resolve_drain_linger

Function resolve_drain_linger 

Source
pub fn resolve_drain_linger(raw: Option<String>, fallback: Duration) -> Duration
Expand description

Resolve an env-derived drainer idle-linger budget (a raw [DRAIN_LINGER_ENV]-style value, MICROSECONDS) into RuntimeOptions::drain_linger: a missing or non-numeric value keeps fallback (the host-provided field, [DEFAULT_DRAIN_LINGER_MICROS] by default); 0 disables lingering; anything else is clamped to [MAX_DRAIN_LINGER_MICROS] so an extreme value (e.g. u64::MAX) tunes the wave optimization instead of pinning pool workers on never-expiring lingers. RuntimeOptions validation re-applies the same clamp, so a host bypassing this resolver cannot smuggle an unbounded budget either.