lib/workless/scalers/heroku_cedar.rb in rcarvalho-workless-1.0.2.1 vs lib/workless/scalers/heroku_cedar.rb in rcarvalho-workless-1.0.2.2
- old
+ new
@@ -12,10 +12,11 @@
nw = self.calculate_num_workers
client.ps_scale(ENV['APP_NAME'], :type => 'worker', :qty => nw) if nw
end
def self.down
- client.ps_scale(ENV['APP_NAME'], :type => 'worker', :qty => 0) unless self.workers == 0 or self.jobs.count > 0
+ nw = self.calculate_num_workers
+ client.ps_scale(ENV['APP_NAME'], :type => 'worker', :qty => nw) unless self.workers == 0 or self.jobs.count > 0
end
def self.workers
client.ps(ENV['APP_NAME']).count { |p| p["process"] =~ /worker\.\d?/ }
end