Count attempts across the whole request
GitHub advises waiting and increasing delays when rate-limit errors continue. The sample below is an original local budget, not a GitHub limit: one initial call plus at most two retries, within a 20-second overall deadline. Retry only where the actual operation is safe.
| Attempt | Eligible wait | Stop condition |
|---|---|---|
| Initial | No backoff yet | Permanent validation error |
| Retry A | Locally selected 1–2 second jitter | Server minimum wait exceeds remaining deadline |
| Retry B | Locally selected 3–5 second jitter | Budget ends even if transient failure continues |
Avoid multiplying retries at each layer
A client with three attempts calling a proxy with three attempts can cause nine downstream attempts. Place the budget where it can see the complete operation, propagate deadline/cancellation and preserve an idempotency identity for writes. Record the last response without logging credentials.
A 30-second server wait arrives with only 8 seconds left. Should the client shorten it to fit?
Show the worked answer
No. End this budget and schedule a separately owned later action if appropriate. Do not violate the server wait or hide an unbounded retry loop in a worker.