Function
withRetry
(fn: () => Promise<T>, retries = 1, delayMs = 5000)
Source from the content-addressed store, hash-verified
| 1330 | } |
| 1331 | |
| 1332 | async function withRetry<T>(fn: () => Promise<T>, retries = 1, delayMs = 5000): Promise<T> { |
| 1333 | try { |
| 1334 | return await fn() |
| 1335 | } catch (e) { |
| 1336 | if (retries > 0) { |
| 1337 | console.log(`Retrying after ${delayMs}ms...`) |
| 1338 | await sleep(delayMs) |
| 1339 | return withRetry(fn, retries - 1, delayMs) |
| 1340 | } |
| 1341 | throw e |
| 1342 | } |
| 1343 | } |
| 1344 | |
| 1345 | function footer(opts?: { image?: boolean }) { |
| 1346 | const image = (() => { |
Tested by
no test coverage detected