Class: SidekiqAutoscale::Strategies::LinearScaling

Inherits:
BaseScaling
  • Object
show all
Defined in:
lib/sidekiq_autoscale/strategies/linear_scaling.rb

Constant Summary collapse

LOG_TAG =
"[SIDEKIQ_SCALE][LINEAR_SCALING]"

Instance Method Summary collapse

Methods inherited from BaseScaling

#log_job

Instance Method Details

#scaling_direction(_job) ⇒ Object



12
13
14
15
16
17
# File 'lib/sidekiq_autoscale/strategies/linear_scaling.rb', line 12

def scaling_direction(_job)
  return 1 if workload_too_high?
  return -1 if workload_too_low?

  0
end

#workload_change_needed?(_job) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/sidekiq_autoscale/strategies/linear_scaling.rb', line 8

def workload_change_needed?(_job)
  workload_too_high? || workload_too_low?
end