Skip to content
Client
Server

Reference / @open-music-sdk/core / tRetryPolicy

Interface: tRetryPolicy ​

Defined in: packages/core/src/retry.ts:5

Every field is optional and an explicit undefined means the default. Invalid values throw a TypeError.

Properties ​

baseDelayMs? ​

ts
readonly optional baseDelayMs?: number;

Defined in: packages/core/src/retry.ts:9

Upper bound of the first backoff in milliseconds; doubles each attempt. Default 250.


maxAttempts? ​

ts
readonly optional maxAttempts?: number;

Defined in: packages/core/src/retry.ts:7

Attempts in total, the first included. A positive integer. Default 2.


maxDelayMs? ​

ts
readonly optional maxDelayMs?: number;

Defined in: packages/core/src/retry.ts:11

Cap on the backoff. A Retry-After header is honoured beyond it, up to maxRetryAfterMs. Default 4000.


maxRetryAfterMs? ​

ts
readonly optional maxRetryAfterMs?: number;

Defined in: packages/core/src/retry.ts:16

The longest Retry-After to wait for. A longer one is not waited for: the error is thrown at once with retryAfterMs attached so the caller can decide. Default 60 000; at most 2^31 - 1 (setTimeout's limit).


retryOn? ​

ts
readonly optional retryOn?: (error) => boolean;

Defined in: packages/core/src/retry.ts:18

Which errors deserve another attempt. Default: retryable. A client asks this of a POST only for an error that says the POST was not carried out.

Parameters ​

error ​

AppleMusicError

Returns ​

boolean

MIT licensed. Not affiliated with, endorsed by, or sponsored by Apple Inc. Apple Music and MusicKit are trademarks of Apple Inc.