MCPcopy
hub / github.com/google/zx / expBackoff

Function expBackoff

src/goods.ts:252–262  ·  view source on GitHub ↗
(
  max: Duration = '60s',
  delay: Duration = '100ms'
)

Source from the content-addressed store, hash-verified

250}
251
252export function* expBackoff(
253 max: Duration = '60s',
254 delay: Duration = '100ms'
255): Generator<number, void, unknown> {
256 const maxMs = parseDuration(max)
257 const randMs = parseDuration(delay)
258 let n = 0
259 while (true) {
260 yield Math.min(randMs * 2 ** n++, maxMs)
261 }
262}
263
264export async function spinner<T>(callback: () => T): Promise<T>
265export async function spinner<T>(title: string, callback: () => T): Promise<T>

Callers 2

goods.test.tsFile · 0.90
goods.test-d.tsFile · 0.85

Calls 1

parseDurationFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…