Briefle words · Code & architecture
Exponential backoff
Waiting longer after each failed attempt, typically doubling the delay, to give a struggling service time to recover.
Say it to an AI
Python send_sms(to, body, key) that retries up to 5 times with exponential backoff and jitter (1s, 2s, 4s…), honoring Retry-After on 429 (capped at 30s), but only for transient errors: HTTP 429, 5xx, timeouts and connection errors. Send the same idempotency key on every attempt so a retry can't double-send. Re-raise any other 4xx error immediately.
How an expert would brief the stronger version of “SMS retry loop”.
See it
Try it as a puzzle →Pull request adding retries to the function that sends appointment reminder texts through an SMS provider's API.
Why: B sleeps 2 ** attempt seconds (1, 2, 4, 8) between attempts, and min(..., 30) also caps a long Retry-After. A always sleeps exactly 1 second, so it never gives a struggling provider more time to recover.
Related words
Room 4 · Errors & edge cases
Learn “Exponential backoff” in a five-minute lesson