如何检查延迟的作业是否真的在重试

How to check if the delayed job is actually retrying

我有以下方法

def max_attempts
  3
end

但是我想检查是不是没有网络,或者我正在建立的第三方连接不可用。我想要延迟的工作重试它。我已经关闭了互联网,但我看不到 Delayed::Job 越来越多。

您可以查看:

Delayed::Job.find(id).attempts

attempts 应该会显示它尝试了多少次尝试,如果达到最大值,它将停止尝试。

确保您没有在某个地方发现错误,否则延迟作业会认为它成功并且将从 table 中删除。