什么可能是sidekiq_retries_exhausted
不被调用的原因是什么?有一些设置我失踪?
可能是一些被覆盖sidekiq_options retry: 1
,和工人不断重试,但什么?
class SomeWorker
include Sidekiq::Worker
sidekiq_options retry: 1
sidekiq_retries_exhausted do |msg|
# => never hit this point
Rails.logger.info "tried two times, failed"
end
def perform(_args)
raise
end
end
问题是,通过这样的代码添加作业时:
Sidekiq::Client.push(
'class' => 'SomeWorker',
'args' => [
foo: "bar",
],
)
重试在类声明sidekiq_options retry: 1
设定,省略了某些原因(错误?/设计?)。相反'retry' => 1
需要明确设置:
Sidekiq::Client.push(
'class' => 'SomeWorker',
'args' => [
foo: "bar",
],
'retry' => 1
)