Skip to content

Instantly share code, notes, and snippets.

@naveda89
Forked from mrrooijen/resque-reenqueue.rb
Last active August 29, 2015 14:06
Show Gist options
  • Save naveda89/5960393f3460427f2b8c to your computer and use it in GitHub Desktop.
Save naveda89/5960393f3460427f2b8c to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment