Class: Rack::Timeout::Scheduler::RepeatEvent

Inherits:
RunEvent
  • Object
show all
Defined in:
lib/rack/timeout/support/scheduler.rb

Instance Attribute Summary

Attributes inherited from RunEvent

#monotime, #proc

Instance Method Summary collapse

Methods inherited from RunEvent

#cancel!, #cancelled?

Constructor Details

#initialize(monotime, proc, every) ⇒ RepeatEvent

Returns a new instance of RepeatEvent.



43
44
45
46
47
48
# File 'lib/rack/timeout/support/scheduler.rb', line 43

def initialize(monotime, proc, every)
  @start = monotime
  @every = every
  @iter  = 0
  super(monotime, proc)
end

Instance Method Details

#run!Object



50
51
52
53
54
# File 'lib/rack/timeout/support/scheduler.rb', line 50

def run!
  super
ensure
  self.monotime = @start + @every * (@iter += 1) until monotime >= Rack::Timeout::MonotonicTime.fsecs
end