假设我有一个看起来像这样的工人类:
class BuilderWorker
include Sidekiq::Worker
sidekiq_options retry: false
def perform(order_id)
if(order_id == 5)
# How can I finish the job here? Say I want to finish it with a status of FAIL or COMPLETE.
end
end
end
我正在寻找一种方法来完成一个来自Worker类的工作,并在完成后给它状态为FAILED。完成应该是安静的(不提出异常)
答案 0 :(得分:1)
使用Sidekiq只有两个工作结果:
您的复杂场景称为应用程序逻辑,Sidekiq无法提供它。写下这个逻辑取决于你。