lib/workless/scalers/local.rb in workless-1.0.0 vs lib/workless/scalers/local.rb in workless-1.0.1

- old
+ new

@@ -5,20 +5,25 @@ module Scaler class Local < Base def self.up - Rush::Box.new[Rails.root].bash("rake jobs:work", :background => true) if self.workers == 0 + if self.workers == 0 + Rush::Box.new[Rails.root].bash("script/delayed_job start -i workless", :background => true) + sleep 1 + end true end def self.down - $exit = true unless jobs.count > 0 + unless jobs.count > 0 and workers > 0 + Rush::Box.new[Rails.root].bash("script/delayed_job stop -i workless", :background => true) + end true end def self.workers - Rush::Box.new.processes.filter(:cmdline => /rake jobs:work/).size + Rush::Box.new.processes.filter(:cmdline => /delayed_job start -i workless|delayed_job.workless/).size end end end