Symptom
All webhook retries fire within ~60ms of each other, hammering merchant endpoints instead of backing off. Merchants complain about being flooded with rapid retry attempts when their servers are recovering from an outage.
What you know
Dispatch uses exponential backoff for retries. The base delay is 1000ms (1 second), and the multiplier is 2x per attempt. The maximum delay should cap at 60 seconds.
Expected backoff schedule:
- Attempt 0: ~1,000ms (1s)
- Attempt 1: ~2,000ms (2s)
- Attempt 2: ~4,000ms (4s)
- Attempt 3: ~8,000ms (8s)
- Attempt 4: ~16,000ms (16s)
Actual behavior: every retry fires after ~60ms regardless of attempt number.
Retry Configuration
BASE_RETRY_DELAY = 1000 ← milliseconds
MAX_RETRY_DELAY = 60 ← what unit is this?
BACKOFF_MULTIPLIER = 2
Log excerpt
[backoff-calculator] Backoff calculated
attempt=0
exponentialDelay=1000
cappedDelay=60 ← capped to 60 instead of 1000?
finalDelay=57
[backoff-calculator] Backoff calculated
attempt=2
exponentialDelay=4000
cappedDelay=60 ← still 60
finalDelay=63
Hints
TypeScript
TypeScript ready
Test Output
▶
Click "Run Tests" to execute your code