Download next.js/packages/font/src/google/retry.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 464 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/font/src/google/retry.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/font/src/google/retry.ts
-
curl -L -o retry.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/font/src/google/retry.ts
464 Bytes
| // eslint-disable-next-line import/no-extraneous-dependencies | |
| // @ts-expect-error File exists | |
| import asyncRetry from 'next/dist/compiled/async-retry' | |
| export async function retry<T>( | |
| fn: asyncRetry.RetryFunction<T>, | |
| retries: number | |
| ) { | |
| return await asyncRetry(fn, { | |
| retries, | |
| onRetry(e: unknown, attempt: unknown) { | |
| console.error( | |
| (e as Error).message + `\n\nRetrying ${attempt}/${retries}...` | |
| ) | |
| }, | |
| minTimeout: 100, | |
| }) | |
| } | |