Created
June 16, 2011 14:13
-
-
Save atonse/1029299 to your computer and use it in GitHub Desktop.
Rake Tasks for Resque Management
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "retry all failed jobs and remove retried jobs" | |
task :retry_all => :environment do | |
# retry all jobs | |
Resque::Failure.all(0, Resque::Failure.count).each_with_index { |j, i| Resque::Failure.requeue(i) unless j['retried_at'] } | |
# remove all retried jobs | |
Resque::Failure.count.times { |i| Resque::Failure.remove(0) if Resque::Failure.all(0)['retried_at'] } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment