API Retry Utility Module

This module provides robust functionality for retrying failed API requests with configurable strategies to improve application reliability in unreliable network conditions or when dealing with service instabilities.

Features:

  • Configurable maximum retry attempts with sensible defaults
  • Exponential backoff algorithm for progressively increasing wait time
  • Random jitter to prevent thundering herd problems during service recovery
  • Comprehensive error logging with attempt tracking and history
  • Configurable initial delay to customize retry timing
  • Automatic failure propagation after maximum attempts
  • Intelligent delay capping to prevent excessive waits

The retry system is particularly valuable for Spotify API interactions where temporary rate limiting, network instabilities, or service hiccups can occur. The exponential backoff approach ensures the application doesn't flood the API with retry attempts during outages while still providing resilience.

Functions

retryApiCall