Implements retry logic with exponential backoff and jitter.
Provides configurable retry behavior for transient failures with exponential backoff, maximum delay caps, and optional jitter to prevent thundering herd problems.
const result = await RetryUtility.withRetry( async () => await unreliableOperation(), { maxAttempts: 5, baseDelay: 1000, backoffMultiplier: 2, maxDelay: 30000, shouldRetry: (error) => error.code === 'NETWORK_ERROR' }); Copy
const result = await RetryUtility.withRetry( async () => await unreliableOperation(), { maxAttempts: 5, baseDelay: 1000, backoffMultiplier: 2, maxDelay: 30000, shouldRetry: (error) => error.code === 'NETWORK_ERROR' });
Implements retry logic with exponential backoff and jitter.
Remarks
Provides configurable retry behavior for transient failures with exponential backoff, maximum delay caps, and optional jitter to prevent thundering herd problems.
Example