lib/pallets/scheduler.rb in pallets-0.10.0 vs lib/pallets/scheduler.rb in pallets-0.11.0

- old
+ new

@@ -1,9 +1,10 @@ module Pallets class Scheduler - def initialize(manager) + def initialize(manager, backend) @manager = manager + @backend = backend @needs_to_stop = false @thread = nil end def start @@ -33,11 +34,11 @@ def work loop do break if needs_to_stop? - backend.reschedule_all(Time.now.to_f) + @backend.reschedule_all(Time.now.to_f) wait_a_bit end end def wait_initial_bit @@ -52,12 +53,8 @@ # deal with shutdowns synchronously and as fast as possible seconds.times do break if needs_to_stop? sleep 1 end - end - - def backend - @backend ||= Pallets.backend end end end