Sidekiq: Jobs/workers stuck in busy - how to remove...

Created on 26 Jul 2018  Â·  2Comments  Â·  Source: mperham/sidekiq

Ruby version: 2.4
Sidekiq: 5.1.3

We have several (75) old jobs hanging around in Busy. They haven't been run in 2 years, so we'd like to clear them out. But I haven't found a clean way to do it.

Running this gave us a list of 75 jobs/workers over a year old:

# list all workers more than a year old
workers = Sidekiq::Workers.new
workers.each do |process_id, thread_id, work|
  if Time.at(work['run_at']).to_datetime < 1.year.ago
    puts "ProcessId: #{process_id}, Q: #{work['queue']}, JID: #{work['payload']['jid']}, Retry: #{work['payload']['retry']}, RunAt: #{work['run_at'] ? Time.at(work['run_at']).to_datetime : 'nil'},   EnqueuedAt: #{work['payload']['enqueued_at'] ? Time.at(work['payload']['enqueued_at']) : 'nil'}"
  end
end

Here's a couple examples:

ProcessId: worker3.cluster.example.com:5136:d8a042dfadef, Q: default, JID: 44f1223853f652349eabc877, Retry: true, RunAt: 2016-04-28T08:41:15+00:00,   EnqueuedAt: 2016-04-28 08:41:15 +0000
ProcessId: worker3.cluster.example.com:5136:d8a042dfadef, Q: post_receive, JID: , Retry: , RunAt: 2016-04-28T08:42:02+00:00,   EnqueuedAt: nil

Seems like the old Sidekiq::Workers.prune command would have taken care of them, but that's gone.

Is there a new equivalent, or what's recommended?

All 2 comments

See the change log, circa 4.1.2 and 4.1.3.

On Jul 25, 2018, at 16:00, digitalMoksha notifications@github.com wrote:

Ruby version: 2.4
Sidekiq: 5.1.3

We have several (75) old jobs hanging around in Busy. They haven't been run in 2 years, so we'd like to clear them out. But I haven't found a clean way to do it.

Running this gave us a list of 75 jobs/workers over a year old:

list all workers more than a year old

workers = Sidekiq::Workers.new
workers.each do |process_id, thread_id, work|
if Time.at(work['run_at']).to_datetime < 1.year.ago
puts "ProcessId: #{process_id}, Q: #{work['queue']}, JID: #{work['payload']['jid']}, Retry: #{work['payload']['retry']}, RunAt: #{work['run_at'] ? Time.at(work['run_at']).to_datetime : 'nil'}, EnqueuedAt: #{work['payload']['enqueued_at'] ? Time.at(work['payload']['enqueued_at']) : 'nil'}"
end
end
Here's a couple examples:

ProcessId: worker3.cluster.example.com:5136:d8a042dfadef, Q: default, JID: 44f1223853f652349eabc877, Retry: true, RunAt: 2016-04-28T08:41:15+00:00, EnqueuedAt: 2016-04-28 08:41:15 +0000
ProcessId: worker3.cluster.example.com:5136:d8a042dfadef, Q: post_receive, JID: , Retry: , RunAt: 2016-04-28T08:42:02+00:00, EnqueuedAt: nil
Seems like the old Sidekiq::Workers.prune command would have taken care of them, but that's gone.

Is there a new equivalent, or what's recommended?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Thanks! I'll give it shot...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sandstrom picture sandstrom  Â·  3Comments

agrobbin picture agrobbin  Â·  4Comments

davidcelis picture davidcelis  Â·  3Comments

michaeldiscala picture michaeldiscala  Â·  4Comments

andrewhavens picture andrewhavens  Â·  4Comments