First Failed Job Retry Waits Twice as Long
Level 2 · node · Reliability · Exponential backoff retry count off-by-one
Scenario
A fictional document-conversion queue schedules failed jobs with exponential backoff. The first retry should wait only the base delay, and subsequent failures double that delay. The current scheduler doubles the delay even for the first failure, causing unnecessary latency. Trace how failure counts feed the retry policy and scheduler.
Requirements
For failure counts 1, 2, and 3, return delays of 100ms, 200ms, and 400ms respectively. Only positive integer failure counts are valid; reject zero, negative, and fractional values. The scheduler must add exactly the calculated delay to the supplied reference time.
Acceptance criteria
- The first failure uses the base delay of 100ms.
- The second failure waits 200ms.
- The third failure waits 400ms.
- Failure counts below one or nonintegers throw an error.