说在某些时候我将一个看起来像这样的工作排队:
HardWorker.perform(command_id, user_id)
有什么方法可以删除所有与command_id
关联的作业(来自Redis队列)?
答案 0 :(得分:1)
command_id = 'command id to delete'
queue = Sidekiq::Queue.new('the_queue_name')
queue.each do |job|
if job.klass == 'HardWorker' && job.args.first == command_id
job.delete
end
end