Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
GenRetry: Simple Exponential Backoff in Elixir
1. GenRetry
if at first you don't succeed
pete gamache // ElixirConf 2016 // @gamache
2. TL;DR
• GenRetry provides retry with exponential backoff
for any function that raises an exception when it
fails
• Use it, it's easy
• https://github.com/appcues/gen_retry
3. • Your code is perfect
Works first time, every time
• I am not you
5. J/K, your code fails too
• Failures happen
• Minimizing failures is nice
• Handling failures is even nicer
• Primary weapon: repetition
6. Exponential Backoff
• Set an initial retry delay
• Every time you retry, double the previous delay
• Examples are everywhere
• Optional: jitter adds a random percentage of delay
7. GenRetry basics
• GenRetry.retry/2 handles background processes
where we don't care about the output
-- replaces spawn_link
• GenRetry.Task.async/2 handles future/promise-
style tasks where we do care about the output
--> replaces Task.async