Module: SolidQueue::Timer
Instance Method Summary collapse
Instance Method Details
#wait_until(timeout, condition, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/solid_queue/timer.rb', line 7 def wait_until(timeout, condition, &block) if timeout > 0 deadline = monotonic_time_now + timeout while monotonic_time_now < deadline && !condition.call sleep 0.1 block.call end else while !condition.call sleep 0.5 block.call end end end |