lib/lita/timer.rb in lita-3.0.3 vs lib/lita/timer.rb in lita-3.0.4
- old
+ new
@@ -30,12 +30,14 @@
@recurring
end
# Sleep for the given interval, call the block, then run again if it's a recurring timer.
def run
- sleep @interval
- @block.call(self) if running? && @block
- run if running? && recurring?
+ loop do
+ sleep @interval
+ @block.call(self) if running? && @block
+ break unless running? && recurring?
+ end
end
# Is the timer currently running?
def running?
@running