Skip to content

Instantly share code, notes, and snippets.

@atonse
Created June 16, 2011 14:13
Show Gist options
  • Save atonse/1029299 to your computer and use it in GitHub Desktop.
Save atonse/1029299 to your computer and use it in GitHub Desktop.
Rake Tasks for Resque Management
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