lib/autoscale/heroku.rb in heroku-qc-autoscale-0.0.5 vs lib/autoscale/heroku.rb in heroku-qc-autoscale-0.0.6

- old
+ new

@@ -9,10 +9,15 @@ def workers=(qty) client.post_ps_scale(app, "worker", qty) end + # shutdown all workers + def shutdown + self.workers = 0 + end + def job_count QC::Queries.count.to_i end # scale workers based on scale @@ -30,10 +35,10 @@ self.workers = min_workers end end def calculate_required_workers - scale.rindex{|x| x <= job_count} + 1 + (scale.rindex{|x| x <= job_count}.to_i + 1) end def params { api_key: Autoscale.api_key || ENV['HEROKU_API_KEY'], \ No newline at end of file