the future is in beta

home about

Change Delayed::Job default retry interval

14 Aug 2013

By default Delayed::Job sets the interval between retries using this formula increasing in time:

next_time = last_time + (attempts ** 4) + 5

As Greg Lazarev points out in this anwser you can modify the default interval defining a reschedule_at method in your class. For example:

@video =

Where this is the Video model:

class Video
  def track_encoding
    # your background job code here
  def reschedule_at(attemtps, time) + 3600 * 2 # 2 hours from now

This is the Delayed::Job source code: base.rb