Delivery Retry Time Misreads HTTP-date as Seconds
Level 2 · node · Reliability · Retry-After format handling error
Scenario
When a carrier API returns 429, a worker reads Retry-After to schedule the next attempt. Numeric seconds work, but an HTTP-date value is coerced to a number, becomes NaN, and causes an immediate retry that repeatedly hits the rate limit.
Requirements
- Treat numeric Retry-After values as delay seconds - For HTTP-date values, calculate the delay from the supplied current time - Treat a past HTTP-date as a 0ms delay - Use the default delay when the header is missing or invalid - Keep the calculation deterministic using the supplied now value
Acceptance criteria
- Numeric 5 becomes 5000ms
- A future HTTP-date returns its difference from now
- A past HTTP-date returns 0ms
- A missing header uses the default delay
- An invalid header also uses the default delay