Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 34x 34x 6x 1x 5x 5x 5x | export async function retry<T>(fn: () => Promise<T>, retries: number, delay: number): Promise<T> { try { return await fn(); } catch (error) { if (retries <= 1) { throw error; } console.warn(`Retrying... (${retries - 1} attempts left)`); await new Promise((res) => setTimeout(res, delay)); return retry(fn, retries - 1, delay); } } |