MCPcopy Index your code
hub / github.com/callstack/agent-device / withRetry

Function withRetry

src/utils/retry.ts:174–182  ·  view source on GitHub ↗
(fn: () => Promise<T>, options: RetryOptions = {})

Source from the content-addressed store, hash-verified

172}
173
174export async function withRetry<T>(fn: () => Promise<T>, options: RetryOptions = {}): Promise<T> {
175 return retryWithPolicy(() => fn(), {
176 maxAttempts: options.attempts,
177 baseDelayMs: options.baseDelayMs,
178 maxDelayMs: options.maxDelayMs,
179 jitter: options.jitter,
180 shouldRetry: options.shouldRetry,
181 });
182}
183
184function computeDelay(base: number, max: number, jitter: number, attempt: number): number {
185 const exp = Math.min(max, base * 2 ** (attempt - 1));

Callers 3

retry.test.tsFile · 0.90
dumpUiHierarchyFunction · 0.90
runAppleRunnerCommandFunction · 0.90

Calls 1

retryWithPolicyFunction · 0.85

Tested by

no test coverage detected