O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
GenRetry
if at first you don't succeed
pete gamache // ElixirConf 2016 // @gamache
TL;DR
• GenRetry provides retry with exponential backoff
for any function that raises an exception when it
fails
• Use it,...
• Your code is perfect

Works first time, every time
• I am not you
(my code)
J/K, your code fails too
• Failures happen
• Minimizing failures is nice
• Handling failures is even nicer
• Primary weapo...
Exponential Backoff
• Set an initial retry delay
• Every time you retry, double the previous delay
• Examples are everywhe...
GenRetry basics
• GenRetry.retry/2 handles background processes
where we don't care about the output

-- replaces spawn_li...
Background Process
GenRetry.retry
Task.async
GenRetry.Task.async
In conclusion
• Let it crash -- on your terms
• Check out our other tools!

https://github.com/appcues/
Thanks!
GenRetry: Simple Exponential Backoff in Elixir
GenRetry: Simple Exponential Backoff in Elixir
Próximos SlideShares
Carregando em…5
×

GenRetry: Simple Exponential Backoff in Elixir

926 visualizações

Publicada em

GenRetry is an Elixir library that provides configurable retry with exponential backoff for any function that raises an exception when it fails.

Publicada em: Software
  • Seja o primeiro a comentar

GenRetry: Simple Exponential Backoff in Elixir

  1. 1. GenRetry if at first you don't succeed pete gamache // ElixirConf 2016 // @gamache
  2. 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. 3. • Your code is perfect
 Works first time, every time • I am not you
  4. 4. (my code)
  5. 5. J/K, your code fails too • Failures happen • Minimizing failures is nice • Handling failures is even nicer • Primary weapon: repetition
  6. 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. 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
  8. 8. Background Process
  9. 9. GenRetry.retry
  10. 10. Task.async
  11. 11. GenRetry.Task.async
  12. 12. In conclusion • Let it crash -- on your terms • Check out our other tools!
 https://github.com/appcues/
  13. 13. Thanks!

×