Skip to content

Instantly share code, notes, and snippets.

@julien-duponchelle
Forked from PatrickTulskie/resque_retry.rb
Created December 30, 2013 15:11
Show Gist options
  • Save julien-duponchelle/8183192 to your computer and use it in GitHub Desktop.
Save julien-duponchelle/8183192 to your computer and use it in GitHub Desktop.
# inspired by http://ariejan.net/2010/08/23/resque-how-to-requeue-failed-jobs
# retry all failed Resque jobs except the ones that have already been retried
# This is, for instance, useful if you have already retried some jobs via the web interface.
Resque::Failure.count.times do |i|
Resque::Failure.requeue(i) unless Resque::Failure.all(i, 1)['retried_at'].present?
end
# retry all :)
Resque::Failure.count.times do |i|
Resque::Failure.requeue(i)
end
# Clear the failed queue
Resque::Failure.clear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment