MCPcopy Index your code
hub / github.com/anomalyco/opencode / withRetry

Function withRetry

packages/opencode/src/cli/cmd/github.handler.ts:1332–1343  ·  view source on GitHub ↗
(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 = (() => {

Callers 1

createPRFunction · 0.85

Calls 3

fnFunction · 0.70
sleepFunction · 0.50
logMethod · 0.45

Tested by

no test coverage detected