retryable icon indicating copy to clipboard operation
retryable copied to clipboard

Exponention back-off

Open petemounce opened this issue 12 years ago • 0 comments

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.

petemounce avatar Jan 24 '13 23:01 petemounce