Module: HerokuResqueAutoScale
- Defined in:
- lib/heroku-resque-workers-scaler/config.rb,
lib/heroku-resque-workers-scaler/scaler.rb,
lib/heroku-resque-workers-scaler/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
'0.2.1'
Instance Method Summary collapse
- #after_enqueue_scale_up(*args) ⇒ Object
- #after_perform_scale_down(*args) ⇒ Object
- #on_failure_scale_down(exception, *args) ⇒ Object
Instance Method Details
#after_enqueue_scale_up(*args) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/heroku-resque-workers-scaler/scaler.rb', line 83 def after_enqueue_scale_up(*args) HerokuResqueAutoScale::Config.thresholds.reverse_each do |scale_info| # Run backwards so it gets set to the highest value first # Otherwise if there were 70 jobs, it would get set to 1, then 2, then 3, etc # If we have a job count greater than or equal to the job limit for this scale info if Scaler.job_count >= scale_info[:job_count] # Set the number of workers unless they are already set to a level we want. Don't scale down here! if Scaler.workers <= scale_info[:workers] Scaler.workers = scale_info[:workers] end break # We've set or ensured that the worker count is high enough end end end |
#after_perform_scale_down(*args) ⇒ Object
75 76 77 |
# File 'lib/heroku-resque-workers-scaler/scaler.rb', line 75 def after_perform_scale_down(*args) scale_down end |
#on_failure_scale_down(exception, *args) ⇒ Object
79 80 81 |
# File 'lib/heroku-resque-workers-scaler/scaler.rb', line 79 def on_failure_scale_down(exception, *args) scale_down end |