| 26 | const backoff = Math.max(0, Number(delay) || 0); |
| 27 | |
| 28 | const attemptFetch = attempt => |
| 29 | fetch(url, { ...options, signal: AbortSignal.timeout(30000) }).catch(e => { |
| 30 | if (attempt === retries || !isTimeoutError(e)) { |
| 31 | throw e; |
| 32 | } |
| 33 | |
| 34 | return sleep(backoff * attempt).then(() => attemptFetch(attempt + 1)); |
| 35 | }); |
| 36 | |
| 37 | return attemptFetch(1); |
| 38 | }; |
no test coverage detected