View Source Flamel.Retryable (flamel v1.10.0)
Documentation for Flamel.Retryable
.
Summary
Types
The number of milliseconds the next retry should happen in
Functions
Calculate a retry interval
Create an Exponential Retry Strategy
Create an HTTP Retry Strategy.
Create a Linear Retry Strategy
Executes a function based on the Flamel.Retryable.Strategy
. The function is
expected to return either a {:ok, result, strategy} or {:error, reason, strategy} tuple. If an error tuple is returned or an exception occurs the function will be retryed
based on the strategy configuration.
Types
@type interval() :: timeout()
The number of milliseconds the next retry should happen in
Functions
Calculate a retry interval
@spec exponential(keyword()) :: Flamel.Retryable.Exponential.t()
Create an Exponential Retry Strategy
Examples
iex> Flamel.Retryable.exponential(multiplier: 10)
%Flamel.Retryable.Exponential{multiplier: 10}
@spec http(keyword()) :: Flamel.Retryable.Http.t()
Create an HTTP Retry Strategy.
This strategy requires setting the HTTP status code so that it can adjust the retry interval based on the status.
Examples
iex> Flamel.Retryable.http(max_attempts: 10)
%Flamel.Retryable.Http{max_attempts: 10}
@spec linear(keyword()) :: Flamel.Retryable.Linear.t()
Create a Linear Retry Strategy
Examples
iex> Flamel.Retryable.linear(max_attempts: 10)
%Flamel.Retryable.Linear{max_attempts: 10}
Executes a function based on the Flamel.Retryable.Strategy
. The function is
expected to return either a {:ok, result, strategy} or {:error, reason, strategy} tuple. If an error tuple is returned or an exception occurs the function will be retryed
based on the strategy configuration.
Examples
iex> strategy = Flamel.Retryable.linear()
iex> Flamel.Retryable.try(strategy, fn strategy -> {:ok, "success", strategy} end)
iex> {:ok, "success", strategy}