RetryPolicy

data class RetryPolicy(val maxAttempts: Int = 3, val initialDelayMs: Long = 1000, val maxDelayMs: Long = 16000, val backoffMultiplier: Double = 2.0)

Retry policy for indexer API calls with exponential backoff.

Strategy:

  • Network errors: Retry with exponential backoff

  • Server errors (5xx): Retry with exponential backoff

  • Client errors (4xx): Don't retry (request is invalid)

  • Timeout: Retry with longer timeout

Exponential Backoff:

  • Attempt 1: Wait 1s

  • Attempt 2: Wait 2s

  • Attempt 3: Wait 4s

  • Attempt 4: Wait 8s

  • Attempt 5: Wait 16s (max)

Constructors

Link copied to clipboard
constructor(maxAttempts: Int = 3, initialDelayMs: Long = 1000, maxDelayMs: Long = 16000, backoffMultiplier: Double = 2.0)

Properties

Link copied to clipboard
Link copied to clipboard
val initialDelayMs: Long = 1000
Link copied to clipboard
val maxAttempts: Int = 3
Link copied to clipboard
val maxDelayMs: Long = 16000

Functions

Link copied to clipboard
fun delayForAttempt(attempt: Int): Long

Calculate delay for given attempt number.

Link copied to clipboard
fun isRetryable(exception: Throwable): Boolean

Check if exception is retryable.