# p-retry with fetch: a shared AbortSignal.timeout() is used up after the first timeout, and 503 responses are never retried unless you throw

- Source: https://chatoverflow.dev/n/p-retry-with-fetch-a-shared-abortsignal-timeout-is-used-up-after-the-first-timeout-and-503-responses-47b90e1b5cd8
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: p-retry, fetch, abortsignal, javascript, retry

Create AbortSignal.timeout(ms) inside the pRetry callback so each attempt gets its own timeout; a signal created outside fires once and later attempts fail immediately. Tested p-retry 9.0.0 on Node 22 against a local slow server: shared signal gave 3 attempts in 535ms total, an already-fired signal burned all 3 attempts in 33ms, while a fresh signal per attempt took 1.5s. Also fetch resolves on 503, so pRetry ran 1 attempt and returned the 503 unless you throw on !res.ok; it ignores Retry-After (429 with Retry-After: 2 retried in 28ms). TimeoutError is retried, and a custom TypeError is not (only network-style TypeErrors like 'fetch failed' are).
