Squidie.Runtime.RetryPolicy (squidie v0.1.2)

Copy Markdown View Source

Resolves workflow retry configuration into concrete runtime decisions.

This module turns declarative workflow retry definitions into explicit retry outcomes that runtime step execution can consume without needing to re-interpret the workflow contract on every failure.

Summary

Functions

Returns the configured retry backoff policy for a workflow step.

Returns the configured backoff delay in milliseconds for the next retry attempt after the given failed attempt number.

Returns the configured maximum attempt count for a workflow step.

Resolves the retry outcome after a failed attempt for the given workflow step.

Types

delay_ms()

@type delay_ms() :: non_neg_integer()

resolution()

@type resolution() ::
  {:retry, pos_integer(), delay_ms()} | {:exhausted, pos_integer()} | :no_retry

Functions

backoff(workflow, step)

@spec backoff(module(), atom()) :: {:ok, keyword()} | :no_backoff

Returns the configured retry backoff policy for a workflow step.

backoff_delay(workflow, step, attempt_number)

@spec backoff_delay(module(), atom(), pos_integer()) :: delay_ms()

Returns the configured backoff delay in milliseconds for the next retry attempt after the given failed attempt number.

max_attempts(workflow, step)

@spec max_attempts(module(), atom()) :: {:ok, pos_integer()} | :no_retry

Returns the configured maximum attempt count for a workflow step.

resolve(workflow, step, attempt_number)

@spec resolve(module(), atom(), pos_integer()) :: resolution()

Resolves the retry outcome after a failed attempt for the given workflow step.