AzureSDK.Core.Retry (Azure SDK v0.1.0)

Copy Markdown View Source

Retry policy for transient Azure failures.

Retries on HTTP 408, 429, and 5xx responses with exponential backoff.

Summary

Functions

Sleeps for the computed backoff duration and emits retry telemetry.

Returns the default retry policy.

Computes the backoff delay in milliseconds for a given attempt number.

Returns true when the response should be retried.

Types

policy()

@type policy() :: %{
  max_attempts: pos_integer(),
  base_delay_ms: pos_integer(),
  max_delay_ms: pos_integer()
}

Functions

backoff(policy, attempt, metadata)

@spec backoff(policy(), pos_integer(), map()) :: :ok

Sleeps for the computed backoff duration and emits retry telemetry.

default_policy()

@spec default_policy() :: %{max_attempts: 3, base_delay_ms: 200, max_delay_ms: 5000}

Returns the default retry policy.

delay_ms(policy, attempt)

@spec delay_ms(policy(), pos_integer()) :: non_neg_integer()

Computes the backoff delay in milliseconds for a given attempt number.

retryable?(arg1)

@spec retryable?(AzureSDK.Core.Response.t()) :: boolean()

Returns true when the response should be retried.