Class: DynoScaler::Heroku
- Inherits:
-
Object
- Object
- DynoScaler::Heroku
- Defined in:
- lib/dyno_scaler/heroku.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
Returns the value of attribute application.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(application, options = {}) ⇒ Heroku
constructor
A new instance of Heroku.
- #running_workers ⇒ Object
- #scale_workers(quantity) ⇒ Object
Constructor Details
#initialize(application, options = {}) ⇒ Heroku
Returns a new instance of Heroku.
7 8 9 10 |
# File 'lib/dyno_scaler/heroku.rb', line 7 def initialize(application, ={}) self.application = application self. = || {} end |
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
5 6 7 |
# File 'lib/dyno_scaler/heroku.rb', line 5 def application @application end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/dyno_scaler/heroku.rb', line 5 def @options end |
Instance Method Details
#running_workers ⇒ Object
16 17 18 19 20 |
# File 'lib/dyno_scaler/heroku.rb', line 16 def running_workers heroku_client.get_ps(application).body.select do |process| process['process'].start_with?('worker') end.count end |
#scale_workers(quantity) ⇒ Object
12 13 14 |
# File 'lib/dyno_scaler/heroku.rb', line 12 def scale_workers(quantity) heroku_client.post_ps_scale(application, 'worker', quantity) end |