Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
492 views
in Technique[技术] by (71.8m points)

Sidekiq jobs not going to the dead set, even with retry settings set to 0

According to https://github.com/mperham/sidekiq/wiki/Error-Handling#dead-job-queue, you can simply add the following to your worker and it'll go to the dead set when the job fails:

sidekiq_options retry: 0

However, in my case, this doesn't seem to work. I specified this value and specifically put in a statement that would cause the worker to fail, which is

class EmailNotificationWorker
  include Sidekiq::Worker
  sidekiq_options queue: Rails.env.to_sym, retry: 0
  require "securerandom"

  def perform(opts = {})
    puts hello
  end
end

The job fails as expected:

2021-01-22T17:53:05.057Z pid=11722 tid=gn9mxkn5e WARN: NameError: undefined local variable or method `hello' for #<EmailNotificationWorker:0x0000556bf59a5c48>
2021-01-22T17:53:05.057Z pid=11722 tid=gn9mxkn5e WARN: /myapp/app/workers/email_notification_worker.rb:9:in `perform'

However, it just goes to the 'retries' section in the Sidekiq UI:

enter image description here

What am I missing here? The retry count has already reached 3 although the sidekiq options are set to not retry and to send it straight to the dead set.

For the past few years, I have never really seen or heard of DeadSet within Sidekiq and have never had to go to that tab. Do I have to explicitly enable jobs to go here or should this happen on its own? If it's supposed to happen on its own, why is the job continuing to requeue itself back up?

question from:https://stackoverflow.com/questions/65850351/sidekiq-jobs-not-going-to-the-dead-set-even-with-retry-settings-set-to-0

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Figured out that the issue was due to the rails console that called EmailNotificationWorker.perform_async needed to be restarted. I thought restarting sidekiq would do the trick but nope.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...