Class: Autoscaler::BinaryScalingStrategy

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(active_workers = 1) ⇒ 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



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