我想从Rails控制台计算可用的Sidekiq线程/处理器的总数。
threads != workers
Sidekiq::Workers.size doesn't work
答案 0 :(得分:3)
您正在寻找Sidekiq::ProcessSet#each
。
https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/api.rb#L719
Sidekiq::ProcessSet.new.each do |pro|
puts "I have #{pro['concurrency'] - pro['busy']} threads free"
end