elixir_retry v0.2.0 Retry
Retry functions.
Summary
Functions
Executes fun until it succeeds or we have run out of retry_delays. Each retry is preceded by a sleep of the specified retry delay
Returns stream of delays that are exponentially increasing. Stream halts once the specified budget of milliseconds has elapsed
Returns stream that returns specified number of the specified delay
Macros
Retry block of code with a exponential backoff delay between attempts
Retry block of code a maximum number of times with a fixed delay between attempts
Functions
Executes fun until it succeeds or we have run out of retry_delays. Each retry is preceded by a sleep of the specified retry delay.
Returns stream of delays that are exponentially increasing. Stream halts once the specified budget of milliseconds has elapsed.
Macros
Retry block of code with a exponential backoff delay between attempts.
Example
backoff 1000, delay_cap: 100 do
# interact the external service
end
Runs the block repeated until it succeeds or 1 second elapses with an
exponentially increasing delay between attempts. Execution is deemed a failure
if the block returns {:error, _} or raises a runtime error.
The delay_cap is optional. If specified it will be the max duration of any
delay. In the example this is saying never delay more than 100ms between
attempts. Omitting delay_cap is the same as setting it to :infinity.
Retry block of code a maximum number of times with a fixed delay between attempts.
Example
retry 5 in 500 do
# interact with external service
end
Runs the block up to 5 times with a half second sleep between each
attempt. Execution is deemed a failure if the block returns {:error, _} or
raises a runtime error.