我有很多作业堵塞在Sidekiq的重试队列中,延迟很高。由于某种原因,它们没有工作,我无法找到一种方法直接从重试队列本身调度这些作业的重试。我该怎么做呢,基本上是强制重试所有这些?
dm7nw8vv1#
似乎没有办法直接做到这一点。重试次数耗尽的重试作业最终应该转到DeadSet。首先收集重试作业及其参数:
DeadSet
require 'sidekiq/api' jobs = Sidekiq::Queue.new("retries").map { |j| [j.klass, j.args] } # => e.g.: # ["MyWorker", [125396, "some_arg"]], # ["MyWorker", [125394, "some_arg"]], # ["MyWorker", [125395, "some_arg"]], # ["MyWorker", [98761, "another_arg"]], # ["MyWorker", [98760, "another_arg"]], # ["MyWorker", [41624, "another_arg"]], # ["MyWorker", [41623, "another_arg"]], # ["MyWorker", [32164, "another_arg"]], # ["MyWorker", [32167, "some_arg"]], # ["MyWorker", [32165, "another_arg"]], # ["MyWorker", [31870, "some_arg"]], # ["MyWorker", [31871, "some_arg"]]]
字符串现在,为每个作业安排立即重试:
jobs.each do |job| klass = job[0].constantize args = job[1] klass.perform_async(*args) end
型最后,我们清除重试队列:
Sidekiq::Queue.new("retries").clear
型
1条答案
按热度按时间dm7nw8vv1#
似乎没有办法直接做到这一点。重试次数耗尽的重试作业最终应该转到
DeadSet
。首先收集重试作业及其参数:字符串
现在,为每个作业安排立即重试:
型
最后,我们清除重试队列:
型