从工人(红宝石)那里获得运行作业sidekiq

时间:2018-09-05 12:41:03

标签: ruby sidekiq delayed-job sidekiq-monitor

workers = Sidekiq::Workers.new
workers.each do |_process_id, _thread_id, work|
  p work['payload']['jid']
end

我如何从工人那里得到这份工作?

我有jid,但是作业不在队列中,因为它仍在运行...

1 个答案:

答案 0 :(得分:0)

您应该可以通过sidekiq API queue

来获取此信息

类似:

queue = Sidekiq::Queue.new("mailer")
queue.select do |job|
  job.jid == 'abcdef1234567890' # use your actual jid
end

您也许还可以:

Sidekiq::Status.get_all('9bb6c1c7cede38e6b8085d72') # use jid