Class: Honcho::Adapters::Sidekiq
- Defined in:
- lib/honcho/adapters/sidekiq.rb
Instance Attribute Summary
Attributes inherited from Base
#config, #redis, #runner, #running, #stopping
Instance Method Summary collapse
Methods inherited from Base
#check_for_work, #commands, #initialize, #name, #path, #really_stop, #run?, #running?, #should_stop?, #start, #start_command, #stop, #stopping?, #total_count, #type
Constructor Details
This class inherits a constructor from Honcho::Adapters::Base
Instance Method Details
#busy_count ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/honcho/adapters/sidekiq.rb', line 10 def busy_count processes = redis.smembers("#{namespace}:processes") counts = processes.map do |process| redis.hget("#{namespace}:#{process}", 'busy').to_i end counts.inject(&:+) || 0 end |
#namespace ⇒ Object
18 19 20 |
# File 'lib/honcho/adapters/sidekiq.rb', line 18 def namespace config.fetch('namespace') end |
#queued_count ⇒ Object
4 5 6 7 8 |
# File 'lib/honcho/adapters/sidekiq.rb', line 4 def queued_count queues = redis.keys("#{namespace}:queue:*") counts = queues.map { |q| redis.llen(q) } counts.inject(&:+) || 0 end |