Class: Maxwell::Agent::Scheduler
- Inherits:
-
Object
- Object
- Maxwell::Agent::Scheduler
- Includes:
- Celluloid
- Defined in:
- lib/maxwell/agent/scheduler.rb
Instance Method Summary collapse
-
#initialize ⇒ Scheduler
constructor
A new instance of Scheduler.
- #run ⇒ Object
- #runner ⇒ Object
- #schedule_work ⇒ Object
- #work_schedule ⇒ Object
- #worker ⇒ Object
Constructor Details
#initialize ⇒ Scheduler
Returns a new instance of Scheduler.
6 7 8 |
# File 'lib/maxwell/agent/scheduler.rb', line 6 def initialize async.run end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 |
# File 'lib/maxwell/agent/scheduler.rb', line 14 def run loop do sleep Maxwell.configuration.work_poll schedule_work end end |
#runner ⇒ Object
30 31 32 |
# File 'lib/maxwell/agent/scheduler.rb', line 30 def runner links.detect {|link| Celluloid::SupervisionGroup === link } end |
#schedule_work ⇒ Object
21 22 23 24 |
# File 'lib/maxwell/agent/scheduler.rb', line 21 def schedule_work work = work_schedule.get worker.async.perform(work) if work end |
#work_schedule ⇒ Object
10 11 12 |
# File 'lib/maxwell/agent/scheduler.rb', line 10 def work_schedule runner[:work_schedule] end |
#worker ⇒ Object
26 27 28 |
# File 'lib/maxwell/agent/scheduler.rb', line 26 def worker runner[:worker] end |