Skip to content
Astera Technology

Set a bounded retry budget for an API call

Choose one retrying layer, an elapsed-time limit and a safe response when the budget ends.

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.

Synthetic bounded retry plan
AttemptEligible waitStop condition
InitialNo backoff yetPermanent validation error
Retry ALocally selected 1–2 second jitterServer minimum wait exceeds remaining deadline
Retry BLocally selected 3–5 second jitterBudget ends even if transient failure continues
Download editable CSV ↓

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.

Related resources

System integration services →