Skip to main content Link Search Menu Expand Document (external link)

RetryService overview

Retry logic service for HTTP requests with exponential backoff

Added in v0.0.1


Table of contents


layers

RetryServiceLive

Live implementation of RetryService.

Provides retry logic with exponential backoff and Retry-After header support.

Signature

export declare const RetryServiceLive: Layer.Layer<RetryService, never, never>

Added in v0.0.1

services

RetryService

Context tag for RetryService.

Signature

export declare const RetryService: Context.Tag<RetryService, RetryService>

Added in v0.0.1

utils

RetryService (interface)

Service that provides retry logic for HTTP requests with exponential backoff.

Signature

export interface RetryService {
  /**
   * Wraps an Effect with retry logic based on error classification.
   *
   * Retries transient errors:
   * - NetworkError (if retryable flag is true)
   * - RateLimitError (429 responses with Retry-After header)
   * - PingOneApiError with 5xx status codes (server errors)
   *
   * Does not retry permanent errors:
   * - PingOneAuthError (401, 403)
   * - PingOneValidationError (400, 422)
   * - PingOneApiError with 4xx status codes (except 429)
   *
   * @since 0.0.1
   */
  readonly retryableRequest: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
}

Added in v0.0.1