pub fn pause_before(attempt: u32, first: Duration) -> DurationExpand description
What:
The pause before try number attempt (the first new try is number one): the first pause, doubled each time, never past
the longest.
Why:
Short pauses mend a stall quickly; longer ones keep a host that is offline for an hour from being asked every few seconds.
In TS you’d write (pseudocode):
Math.min(first * 2 ** (attempt - 1), LONGEST)