withRetry<
T
>(
fn: () => Promise<T>, maxRetries: number = DEFAULT_MAX_RETRIES, | Name | Type | Description |
|---|---|---|
fn* | () => Promise<T> | |
maxRetries | number | Default: DEFAULT_MAX_RETRIES |
delayMs | number | Default: DEFAULT_RETRY_DELAY_MS |
Retry an async operation with a fixed delay between attempts.
Useful for working around transient sandbox concurrency limits: when a provider rejects creation because the organisation has too many running sandboxes, waiting a short while and retrying usually succeeds once a previous sandbox finishes shutting down.
The async operation to attempt
Maximum number of attempts (default: 3)
Milliseconds to wait between attempts (default: 10 000)
const sandbox = await withRetry(() => DenoSandbox.create({ memoryMb: 768 }));