Module: EventMachine
- Defined in:
- lib/em_retry.rb
Overview
Tries to evaluate the given block with the given timers until it’s not nil or false.
EM.with_retries(1,2,3){false}
is executed immediatelly, after 1 second, after another 2 secondes and after another 3 seconds.
Class Method Summary collapse
Class Method Details
.with_retries(*timers, &block) ⇒ Object
12 13 14 15 16 |
# File 'lib/em_retry.rb', line 12 def self.with_retries(*timers, &block) block.call || !timers.empty? && EM.add_timer(timers.shift) do with_retries *timers, &block end end |