sidekiq_retries_exhausted从来没有射击

问题描述 投票:0回答:1

什么可能是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
ruby sidekiq
1个回答
0
投票

问题是,通过这样的代码添加作业时:

  Sidekiq::Client.push(
    'class' => 'SomeWorker',
    'args' => [
      foo: "bar",
    ],
  )

重试在类声明sidekiq_options retry: 1设定,省略了某些原因(错误?/设计?)。相反'retry' => 1需要明确设置:

  Sidekiq::Client.push(
    'class' => 'SomeWorker',
    'args' => [
      foo: "bar",
    ],
    'retry' => 1
  )
© www.soinside.com 2019 - 2024. All rights reserved.