Skip to content

.tip

· one of the small things

Honour Retry-After before your own backoff

A 429 or 503 often comes with a Retry-After header saying exactly how long the other side wants you to wait. Exponential backoff that ignores it keeps hammering a service that already told you what it needs.

const wait = Number(res.headers.get("retry-after")) * 1000 || backoff(attempt);

Cap it, add jitter, and log when it happens. A server that keeps sending it is telling you something about your traffic.

httpreliability