How the Backoff counter works
masterThe backoff.Backoff struct acts as a time.Duration counter used to implement exponential backoff strategies.
Core Logic:
- It starts at the value defined in
Min. - Every call to
Duration()multiplies the current duration by theFactor. - The duration is capped at the
Maxvalue. - Calling
Reset()returns the counter to theMinvalue. - Setting
Jittertotrueadds randomness to the returned duration to prevent synchronized retry spikes.