MCPcopy
hub / github.com/prisma/prisma / retry

Function retry

packages/client/tests/e2e/_utils/retry.ts:3–13  ·  view source on GitHub ↗
(fn: () => Promise<A>, max: number, delay: number = 1000)

Source from the content-addressed store, hash-verified

1import timers from 'node:timers/promises'
2
3export async function retry<A>(fn: () => Promise<A>, max: number, delay: number = 1000): Promise<A> {
4 for (let i = 0; i < max; i++) {
5 try {
6 return await fn()
7 } catch (e) {
8 if (i === max - 1) throw e
9 }
10 await timers.setTimeout(delay)
11 }
12 throw 'Unreachable'
13}

Callers 3

_steps.tsFile · 0.90
_steps.tsFile · 0.90
downloadZipFunction · 0.85

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected