Retry
Path:
_archive/loom-stale-pre-sprint-snapshot/src/lib/retry.tsRelative: loom-stale-pre-sprint-snapshot/src/lib/retry.tsSubproject: _archiveCategory: archivedLines: 45Bytes: 1,583Imports: 1Exports: 2
Content Preview
- import { RetryExhaustedError } from "../types/errors";
- /**
- * Exponential backoff with FULL jitter (HC-6): delay = rand(0, min(cap, base·2^n)).
- * Minimum 3 attempts on anything that touches a network.
- */
- export interface RetryOptions {
- attempts?: number; // >= 3 enforced
- baseMs?: number;
- capMs?: number;
- /** Return false to short-circuit on non-retryable errors (e.g. 4xx). */
- retryable?: (e: unknown) => boolean;
- /** Injected for tests; defaults to real sleep. */
- sleep?: (ms: numb