Class: Delayed::Workless::Scaler::HerokuCedar
- Inherits:
-
Base
- Object
- Base
- Delayed::Workless::Scaler::HerokuCedar
show all
- Extended by:
- HerokuClient
- Defined in:
- lib/workless/scalers/heroku_cedar.rb
Class Method Summary
collapse
client
Methods inherited from Base
calculate_num_workers, jobs, num_workers_cache, num_workers_cache=, scale_info=
Class Method Details
.down ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/workless/scalers/heroku_cedar.rb', line 22
def self.down
nw = self.calculate_num_workers
if nw
if self.num_workers_cache != nw
self.num_workers_cache = nw
client.ps_scale(ENV['APP_NAME'], :type => 'worker', :qty => nw)
end
end
rescue
end
|
.up ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/workless/scalers/heroku_cedar.rb', line 11
def self.up
nw = self.calculate_num_workers(true)
if nw
if self.num_workers_cache != nw
self.num_workers_cache = nw
client.ps_scale(ENV['APP_NAME'], :type => 'worker', :qty => nw)
end
end
rescue
end
|
.workers ⇒ Object
33
34
35
|
# File 'lib/workless/scalers/heroku_cedar.rb', line 33
def self.workers
client.ps(ENV['APP_NAME']).count { |p| p["process"] =~ /worker\.\d?/ }
end
|