SpotifyRetryExecutor

class SpotifyRetryExecutor(retryPolicy: RetryPolicy = RetryPolicy(), delayFn: suspend (Long) -> Unit = { delay(it) }, jitterFn: (Long) -> Long = { max -> if (max <= 0L) 0L else Random.nextLong(0L, max + 1) })

Constructors

Link copied to clipboard
constructor(retryPolicy: RetryPolicy = RetryPolicy(), delayFn: suspend (Long) -> Unit = { delay(it) }, jitterFn: (Long) -> Long = { max -> if (max <= 0L) 0L else Random.nextLong(0L, max + 1) })

Functions

Link copied to clipboard
suspend fun <T> execute(request: suspend () -> SpotifyResult<T>): SpotifyResult<T>

Invokes request, retrying on retryable status codes according to retryPolicy, honoring the Retry-After header when present and falling back to exponential backoff with jitter otherwise.