Class: Autoscaler::BinaryScalingStrategy
- Inherits:
-
Object
- Object
- Autoscaler::BinaryScalingStrategy
- Defined in:
- lib/autoscaler/binary_scaling_strategy.rb
Overview
Strategies determine the target number of workers The default strategy has a single worker when there is anything, or shuts it down.
Instance Method Summary collapse
-
#call(system, event_idle_time) ⇒ Integer
Target number of workers.
-
#initialize(active_workers = 1) ⇒ BinaryScalingStrategy
constructor
A new instance of BinaryScalingStrategy.
Constructor Details
#initialize(active_workers = 1) ⇒ BinaryScalingStrategy
Returns a new instance of BinaryScalingStrategy.
6 7 8 |
# File 'lib/autoscaler/binary_scaling_strategy.rb', line 6 def initialize(active_workers = 1) @active_workers = active_workers end |
Instance Method Details
#call(system, event_idle_time) ⇒ Integer
Returns target number of workers.
13 14 15 16 17 18 19 |
# File 'lib/autoscaler/binary_scaling_strategy.rb', line 13 def call(system, event_idle_time) if active?(system) @active_workers else 0 end end |