( fn: asyncRetry.RetryFunction<T>, retries: number )
| 2 | import asyncRetry from 'next/dist/compiled/async-retry' |
| 3 | |
| 4 | export async function retry<T>( |
| 5 | fn: asyncRetry.RetryFunction<T>, |
| 6 | retries: number |
| 7 | ) { |
| 8 | return await asyncRetry(fn, { |
| 9 | retries, |
| 10 | onRetry(e: unknown, attempt: unknown) { |
| 11 | console.error( |
| 12 | (e as Error).message + `\n\nRetrying ${attempt}/${retries}...` |
| 13 | ) |
| 14 | }, |
| 15 | minTimeout: 100, |
| 16 | }) |
| 17 | } |
no outgoing calls
no test coverage detected