lib/sidekiq-heroku-scaler/strategy/latency.rb in sidekiq-heroku-scaler-0.1.3 vs lib/sidekiq-heroku-scaler/strategy/latency.rb in sidekiq-heroku-scaler-0.1.4

- old
+ new

@@ -24,9 +24,15 @@ def decrease?(sidekiq_worker) sidekiq_worker.latency < min_latency && sidekiq_worker.quantity > min_dynos_count end + def safe_quantity(quantity) + return 1 if quantity <= 0 + + quantity > max_dynos_count ? max_dynos_count : quantity + end + private attr_reader :min_dynos_count, :max_dynos_count, :max_latency, :min_latency end end