gpt4 book ai didi

ruby-on-rails - Sidekiq:计算可用线程数

转载 作者:数据小太阳 更新时间:2023-10-29 08:43:51 26 4
gpt4 key购买 nike

我想从 Rails 控制台计算可用 Sidekiq 线程/处理器的总数。

threads != workers

Sidekiq::Workers.size doesn't work

最佳答案

您正在寻找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

关于ruby-on-rails - Sidekiq:计算可用线程数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38469470/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com