Backing Off
What is worth retrying. Something that might succeed if you try again: a 429, a 5xx, a timeout, a dropped connection.
What is not. A 400, 401, 403 or 404. Nothing about the request will improve by repeating it, and retrying a 401 in a loop looks exactly like an attack.
Exponential backoff. Wait one second, then two, then four, then eight. Doubling gives a struggling server room to recover instead of a steady stream of new requests.
Add a little randomness, called jitter, so that many clients recovering from the same outage do not all retry in perfect unison and knock the server over again.
And cap the attempts. Retrying forever turns someone else's brief outage into your own contribution to it.
Mark this lesson complete
Signed in, your progress follows you to every device.