krishna sai
krishna sai

Reputation: 185

How to track the sidekiq jobs that have been killed?

I am looking for a way to track sidekiq jobs that have been killed abruptly. Is there a on_delete kind of operation in sidekiq(I couldnt find any in documentation) I can implement, so that some process is carried out whenever a job gets deleted abruptly.

I looked into sidekiq ruby gem documentation, but couldnt find a solution for this.

I am using sidekiq v5.0.4

Upvotes: 3

Views: 1841

Answers (1)

lacostenycoder
lacostenycoder

Reputation: 11226

Sidekiq jobs which die because of some exception should be retried by using the retry setting

class SomeWorker
  include Sidekiq::Worker

  sidekiq_options retry: 3 # retry 3 times before dying 

  def perform
    # do stuff
  end
end

Jobs which die after all retries end up in the dead queue

There is no easy way to monitor jobs that are deleted from the Sidekiq queues because of devs removing them in the console or deleting them. Once they are deleted there's nothing to hook into anymore as they will be removed from the key/value store i.e. Redis.

If you want to monitor specific job statuses you might want to have a look at the sidekiq-status gem which can help with this.

Upvotes: 1

Related Questions