class Sidetiq::Actor::Clock

Public Class Methods

new(*args, &block) click to toggle source
Calls superclass method Sidetiq::Actor::new
# File lib/sidetiq/actor/clock.rb, line 7
def initialize(*args, &block)
  super

  if Sidekiq.server?
    after(0) do
      debug "Sidetiq::Clock looping ..."
      loop!
    end
  end
end

Private Instance Methods

loop!() click to toggle source
# File lib/sidetiq/actor/clock.rb, line 20
def loop!
  after([time { tick }, 0].max) do
    loop!
  end
rescue StandardError => e
  handle_exception(e, context: 'Sidetiq::Clock#loop!')
  raise e
end
time() { || ... } click to toggle source
# File lib/sidetiq/actor/clock.rb, line 29
def time
  start = gettime
  yield
  Sidetiq.config.resolution - (gettime.to_f - start.to_f)
end