createDefaultRetryPolicy
function createDefaultRetryPolicy(options?: DefaultRetryPolicyOptions): TransferRetryPolicy;Defined in: src/transfers/createDefaultRetryPolicy.ts:80
Creates the SDK’s recommended retry policy for transfer execution.
The policy retries only failures the SDK has marked as safe to retry
(error.retryable === true on a ZeroTransferError), backing off
exponentially with full jitter: each delay is drawn uniformly from
[0, min(maxDelayMs, baseDelayMs * 2^(attempt - 1))), the schedule that
minimizes contention when many clients retry against the same server.
Server pacing hints are honored: when the failed attempt carries
details.retryAfterMs (parsed from an HTTP Retry-After header on 429/503
responses by the web-family providers), the next delay is exactly that
value rather than the jittered backoff. A hint that does not fit in the
remaining maxElapsedMs budget stops retrying instead of retrying early.
Retries also stop once maxElapsedMs has elapsed since execution started,
regardless of how many attempts remain.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | DefaultRetryPolicyOptions | Optional overrides for attempts, delays, and the elapsed budget. |
Returns
Section titled “Returns”A TransferRetryPolicy for TransferEngine.execute, runRoute, TransferQueue, or client-level defaults.
Examples
Section titled “Examples”import { createDefaultRetryPolicy, uploadFile } from "@zero-transfer/sdk";
await uploadFile({ client, destination: { path: "/uploads/report.csv", profile }, localPath: "./out/report.csv", retry: createDefaultRetryPolicy(),});const retry = createDefaultRetryPolicy({ maxAttempts: 3, baseDelayMs: 100, maxDelayMs: 2_000, maxElapsedMs: 15_000,});TransferRetryPolicy for the underlying hook contract.