Rails5,如何重试执行 ActiveJob 特定次数(最大尝试次数)

Rails5, how to retry perform an ActiveJob a specific number of times (max attempts)

现在我有我的后台进程 运行 DelayedJobs,我看到 DelayedJob 上的 max_attempts 功能非常方便,我如何在 ActiveJob 中复制它?

这是否依赖于队列系统? ActiveJob 对此有任何抽象配置吗?

gem ActiveJob::Retry 成功了:

class MyJob < ActiveJob::Base
  include ActiveJob::Retry.new(
    :strategy => :variable,
    :delays => [10.seconds, 1.minute, 10.minutes, 15.minutes]
  )
end