Bobochka
7/2/2015 - 7:15 AM

Resque Re-enqueue

Resque Re-enqueue

require 'resque/errors'

class DatabaseBackupJob
  def self.perform(id, foo, bar)
    # do backup work
  rescue Resque::TermException
    # write failure to database

    # re-enqueue the job so the job won't be lost when scaling down.
    Resque.enqueue(DatabaseBackupJob, id, foo, bar)
  end
end