fastify · Medium · retry policy
A service retries every failure with the same delay. Permanent errors consume capacity while transient errors synchronize into a retry storm.
Task
Return a deterministic retry decision with bounded exponential backoff and server-delay support.
Contract
Input is {attempt,status,retryAfterMs,jitterSeed}. Return {retry,delayMs,reason}. Attempts are zero-based; at most four retries are allowed.
Acceptance criteria
- Retry only 408, 429 and 5xx responses.
- Respect a larger valid retryAfterMs.
- Apply deterministic jitter from jitterSeed.
- Cap delay at 30000 ms and stop after attempt 3.
Constraints
- Do not mutate caller-owned input.
- Keep the supplied framework adapter and public contract unchanged.
- Add candidate tests for at least one boundary not covered by the public cases.
Editable files
src/repair.js— Task-specific state or service boundarytests/candidate.test.js— Candidate-authored regression