@agorio/sdk • Docs
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?
optionalbaseDelayMs:number
Base delay in ms used as the initial backoff. Default: 200.
Defined in
src/http/retry.ts:18
jitter?
optionaljitter:boolean
Add random jitter ± 50% of the computed delay. Default: true.
Defined in
src/http/retry.ts:22
maxAttempts?
optionalmaxAttempts:number
Maximum total attempts including the first try. Default: 3.
Defined in
src/http/retry.ts:16
maxDelayMs?
optionalmaxDelayMs:number
Cap on per-attempt delay in ms. Default: 5000.
Defined in
src/http/retry.ts:20
onRetry()?
optionalonRetry: (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?
optionalretryableStatuses:number[]
HTTP status codes that trigger a retry. Default: 408, 429, 502, 503, 504.
Defined in
src/http/retry.ts:24
shouldRetry()?
optionalshouldRetry: (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