Skip to content

Instantly share code, notes, and snippets.

@jpalumickas
Forked from mrrooijen/resque-reenqueue.rb
Created September 20, 2013 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpalumickas/6638900 to your computer and use it in GitHub Desktop.
Save jpalumickas/6638900 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