lib/workless/scalers/heroku_cedar.rb in rcarvalho-workless-1.0.2.8 vs lib/workless/scalers/heroku_cedar.rb in rcarvalho-workless-1.0.2.9

- old
+ new

@@ -7,11 +7,11 @@ class HerokuCedar < Base extend Delayed::Workless::Scaler::HerokuClient def self.up - @@current_num_workers || 0 + @@current_num_workers ||= 0 nw = self.calculate_num_workers if nw if @@current_num_workers != nw @@current_num_workers = nw client.ps_scale(ENV['APP_NAME'], :type => 'worker', :qty => @@current_num_workers) @@ -19,11 +19,11 @@ end rescue end def self.down - @@current_num_workers || 0 + @@current_num_workers ||= 0 nw = self.calculate_num_workers if nw if @@current_num_workers != nw @@current_num_workers = nw client.ps_scale(ENV['APP_NAME'], :type => 'worker', :qty => nw) @@ -31,10 +31,10 @@ end rescue end def self.workers - @@current_num_workers || 0 + @@current_num_workers ||= 0 @@current_num_workers || client.ps(ENV['APP_NAME']).count { |p| p["process"] =~ /worker\.\d?/ } end end