lib/workless/scalers/local.rb in workless-1.2.1 vs lib/workless/scalers/local.rb in workless-1.2.2
- old
+ new
@@ -1,18 +1,17 @@
require 'rush'
module Delayed
module Workless
module Scaler
-
class Local < Base
-
- def executable_prefix
+
+ def self.executable_prefix
if defined? Delayed::Compatibility.executable_prefix
Delayed::Compatibility.executable_prefix
else
- "script"
+ 'script'
end
end
def self.up
if self.workers == 0
@@ -21,20 +20,18 @@
end
true
end
def self.down
- unless jobs.count > 0 and workers > 0
+ if self.workers > 0 and jobs.count == 0
Rush::Box.new[Rails.root].bash("#{executable_prefix}/delayed_job stop -i workless", :background => true)
end
true
end
def self.workers
Rush::Box.new.processes.filter(:cmdline => /delayed_job start -i workless|delayed_job.workless/).size
end
-
end
-
end
end
end