class SidekiqHerokuScaler::Worker
Attributes
formation[R]
worker_name[R]
Public Class Methods
new(worker_name, formation)
click to toggle source
# File lib/sidekiq-heroku-scaler/worker.rb, line 7 def initialize(worker_name, formation) @worker_name = worker_name @formation = formation end
Public Instance Methods
concurrency()
click to toggle source
# File lib/sidekiq-heroku-scaler/worker.rb, line 12 def concurrency process['concurrency'] || 0 end
formation_id()
click to toggle source
# File lib/sidekiq-heroku-scaler/worker.rb, line 16 def formation_id formation.id end
latency()
click to toggle source
# File lib/sidekiq-heroku-scaler/worker.rb, line 24 def latency queues.sum { |queue| Sidekiq::Queue.new(queue).latency } end
quantity()
click to toggle source
# File lib/sidekiq-heroku-scaler/worker.rb, line 20 def quantity formation.quantity end
queues_size()
click to toggle source
# File lib/sidekiq-heroku-scaler/worker.rb, line 28 def queues_size queues.sum { |queue| Sidekiq::Queue.new(queue).size } end
Private Instance Methods
process()
click to toggle source
# File lib/sidekiq-heroku-scaler/worker.rb, line 44 def process process_set.detect { |p| p.identity.match(/\A#{worker_name}\./) } || {} end
process_set()
click to toggle source
# File lib/sidekiq-heroku-scaler/worker.rb, line 40 def process_set @process_set ||= Sidekiq::ProcessSet.new end
queues()
click to toggle source
# File lib/sidekiq-heroku-scaler/worker.rb, line 36 def queues process['queues'] || [] end