How to delete jobs from Sidekiq Retries

Hi future-me! This is just a list of snippets I might be looking for next time I suddenly have to deal with a huge list of failing Sidekiq jobs being retried over and over.

List job classes sitting in the retries list

Number of jobs being retried for a specific class { |j| j.display_class == "MyJob" }.count

Delete all jobs for a class from the retries list { |j| j.display_class == "MyJob" }.map(&:delete)

(similarly, there’s &:kill, &:retry)

(similarly, there’s Sidekiq::DeadSet, Sidekiq::ScheduledSet)

If the jobs are RES async handlers, list the events:
  .select  { |j| j.display_class == "MyAsyncHandler" }
  .collect { |j| j.args[0]["arguments"][0]["event_id"] }
  .collect { |event_id| }

(warning: the details depend on your RES async scheduler implementation)


Source: Arkency

Leave a Reply

Your email address will not be published.