Guest User

Untitled

a guest
Aug 14th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. ### Time intervals between attempts
  2.  
  3. For fixed intervals, an `:interval` parameter can be passed indicating the time in seconds.
  4. The following example will sleep two seconds between attempts:
  5.  
  6. retry_upto(5, :interval => 2)
  7.  
  8. For customized intervals, the `:interval` parameter can be a lambda, which will be applied
  9. to the number of each attempt. For instance, the following code will sleep 3 seconds after
  10. the first attempt, 6 after the second, 9 after the third...
  11.  
  12. retry_upto(5, :interval => lambda{ |attempt| attempt * 3 })
Add Comment
Please, Sign In to add comment