@agorio/sdkDocs


Interface: RetryOptions

HTTP retry primitive — wraps a fetch-shaped function with exponential backoff. Compose at the call site:

const adapter = new ShopifyAdapter({ store: ‘demo’, storefrontAccessToken: token, fetch: withRetry(globalThis.fetch), });

Pair with withRateLimit and createHttpClient from this directory.

Properties

baseDelayMs?

optional baseDelayMs: number

Base delay in ms used as the initial backoff. Default: 200.

Defined in

src/http/retry.ts:18


jitter?

optional jitter: boolean

Add random jitter ± 50% of the computed delay. Default: true.

Defined in

src/http/retry.ts:22


maxAttempts?

optional maxAttempts: number

Maximum total attempts including the first try. Default: 3.

Defined in

src/http/retry.ts:16


maxDelayMs?

optional maxDelayMs: number

Cap on per-attempt delay in ms. Default: 5000.

Defined in

src/http/retry.ts:20


onRetry()?

optional onRetry: (info) => void

Hook for tests / observability.

Parameters

info

info.attempt: number

info.delayMs: number

info.error?: unknown

info.status?: number

Returns

void

Defined in

src/http/retry.ts:28


retryableStatuses?

optional retryableStatuses: number[]

HTTP status codes that trigger a retry. Default: 408, 429, 502, 503, 504.

Defined in

src/http/retry.ts:24


shouldRetry()?

optional shouldRetry: (response, error, attempt) => boolean

Custom predicate; if provided, fully replaces the status-code check.

Parameters

response: any

error: unknown

attempt: number

Returns

boolean

Defined in

src/http/retry.ts:26