retryable
retryable copied to clipboard
Exponention back-off
It'd be great if as well as passing a number to sleep, it were possible to pass a lambda so one could do things like
retryable(...., tries: 4, sleep: lambda{|s| 4**s} ....) do
unsafe thing
end
and it would retry after 1, 4, 16, and 64s. I guess that could be achieved by clever use of the callbacks to modify a variable that was used as the sleep
parameter, but that seems complicated.