class Maxwell::Agent::Scheduler
Attributes
evented_worker[R]
worder[R]
work_schedule[R]
Public Class Methods
new(opts={})
click to toggle source
# File lib/maxwell/agent/scheduler.rb, line 8 def initialize(opts={}) @work_schedule ||= opts.fetch(:work_schedule) @evented_worker ||= opts.fetch(:evented_worker) @worker ||= opts.fetch(:worker) end
Public Instance Methods
run()
click to toggle source
# File lib/maxwell/agent/scheduler.rb, line 14 def run set_links loop do sleep Agent.configuration.work_poll schedule_work end end
schedule_work()
click to toggle source
# File lib/maxwell/agent/scheduler.rb, line 22 def schedule_work if work = work_schedule.get if work.evented? evented_worker.async.perform(work) else worker.async.perform(work) end end end
Private Instance Methods
set_links()
click to toggle source
# File lib/maxwell/agent/scheduler.rb, line 32 def set_links link(@evented_worker) link(@worker) link(@work_schedule) end