pub fn retry_while_active<Value>(
install: impl FnMut() -> Result<Value>,
limit: u32,
delay: Duration,
) -> Result<Value>Expand description
What:
Run install again while it fails only because another holder is active, up to limit more times.
Why:
Any other failure, and a holder that never lets go, end the wait with the failure itself.
In TS you’d write (pseudocode):
for (let attempt = 0; ; attempt += 1) { try { return install(); } catch (e) { if (!isActive(e) || attempt >= limit) throw e; await wait(delay); } }