Class: SidekiqAutoscale::Strategies::OldestJobScaling

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

Constant Summary collapse

LOG_TAG =
"[SIDEKIQ_SCALE][OLDEST_JOB_SCALING]"

Instance Method Summary collapse

Methods inherited from BaseScaling

#log_job

Instance Method Details

#scaling_direction(_job) ⇒ Object



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

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

  0
end

#workload_change_needed?(_job) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/sidekiq_autoscale/strategies/oldest_job_scaling.rb', line 7

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