🚨 Oh joy, yet another article trying to make "exponential backoff with jitter" sound like the most thrilling #coding concept since the invention of the #semicolon. 🤓 Spoiler alert: it's about as exciting as watching paint dry, but now with a touch of #jitter for those who like their boredom with a side of #randomness. 🎨
https://commaok.xyz/post/simple-backoff/ #exponentialbackoff #humor #techboredom #HackerNews #ngated
https://commaok.xyz/post/simple-backoff/ #exponentialbackoff #humor #techboredom #HackerNews #ngated
Simpler backoff
Exponential backoff with jitter is de rigeur for making service calls. This code, or something like it, probably looks really familiar: func do(ctx context.Context) error { const ( maxAttempts = 10 baseDelay = 1 * time.Second maxDelay = 60 * time.Second ) delay := baseDelay for attempt := range maxAttempts { err := request(ctx) if err == nil { return nil } delay *= 2 delay = min(delay, maxDelay) jitter := multiplyDuration(delay, rand.