HTTP retry helpers with generic status, method, and Retry-After parsing helpers.
Provides retry delay calculation, status classification, and Retry-After parsing.
Summary
Functions
Parse Retry-After headers into milliseconds.
Calculate the retry delay for the given attempt.
Calculate the retry delay with custom initial and max delays.
Determine whether a status code is retryable.
Determine whether a status code is retryable for the given method under caller-provided method rules.
Decide whether a response should be retried based on headers and status.
Decide whether a response should be retried based on the given method, headers, and caller-provided method rules.
Types
Functions
@spec parse_retry_after(headers(), non_neg_integer()) :: non_neg_integer()
Parse Retry-After headers into milliseconds.
Supports:
retry-after-ms- millisecondsretry-after- delta-secondsretry-after- HTTP-date
@spec retry_delay(non_neg_integer()) :: non_neg_integer()
Calculate the retry delay for the given attempt.
@spec retry_delay(non_neg_integer(), pos_integer(), pos_integer()) :: non_neg_integer()
Calculate the retry delay with custom initial and max delays.
Determine whether a status code is retryable.
@spec retryable_status_for_method?( integer(), method(), retryable_statuses_by_method() ) :: boolean()
Determine whether a status code is retryable for the given method under caller-provided method rules.
Rules may be provided as a map or keyword list keyed by HTTP method or :all.
Decide whether a response should be retried based on headers and status.
@spec should_retry_for_method?( method(), map() | {integer(), headers()} | integer(), retryable_statuses_by_method() ) :: boolean()
Decide whether a response should be retried based on the given method, headers, and caller-provided method rules.