或者是否有一个可以接受重试次数的配置。任何输入将不胜感激。我看到这个链接Restart failed jobs of a specific worker in resque并了解如何手动重试作业。我正在寻找使这一步自动化。
问问题
1802 次
2 回答
0
不,Resque 没有内置的重试功能。
您可以使用该插件resque-retry
,或者如果您已经在使用带有 Resque 的 ActiveJob,则可以使用本机retry_on
功能。
请注意,resque-retry
这似乎不适用于 ActiveJob,所以它是非此即彼的。
于 2018-12-11T10:03:44.240 回答
0
您可以使用当作业失败时调用的 resque 失败钩子。
您可以覆盖此方法或使用某些插件来执行此操作。一旦作业失败记录并仅从此处重试。
来自 resque 代码库的代码,文件:resque-1.27.1/lib/resque/job.rb
# Given an exception object, hands off the needed parameters to
# the Failure module.
def fail(exception)
begin
run_failure_hooks(exception)
rescue Exception => e
raise e
ensure
Failure.create \
:payload => payload,
:exception => exception,
:worker => worker,
:queue => queue
end
end
于 2017-03-18T11:05:59.513 回答