Generic retry orchestration with configurable policies.
Summary
Functions
Check whether progress or elapsed-time limits have been exceeded.
Record progress to reset the progress timeout window.
Run a function with retry semantics.
Decide whether to retry based on the policy and current result.
Types
@type retry_result() :: {:retry, non_neg_integer(), Foundation.Retry.State.t()} | {:halt, term(), Foundation.Retry.State.t()}
Functions
@spec check_timeouts( Foundation.Retry.State.t(), Foundation.Retry.Policy.t(), keyword() ) :: :ok | {:error, atom()}
Check whether progress or elapsed-time limits have been exceeded.
@spec record_progress( Foundation.Retry.State.t(), keyword() ) :: Foundation.Retry.State.t()
Record progress to reset the progress timeout window.
@spec run((-> term()), Foundation.Retry.Policy.t(), keyword()) :: {term(), Foundation.Retry.State.t()}
Run a function with retry semantics.
@spec step(Foundation.Retry.State.t(), Foundation.Retry.Policy.t(), term(), keyword()) :: retry_result()
Decide whether to retry based on the policy and current result.