Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

updated resque failure rake task #484

Merged
merged 1 commit into from Feb 18, 2012
Jump to file or symbol
Failed to load files and symbols.
+9 −3
Split
View
@@ -10,11 +10,17 @@ namespace :resque do
rescue ActiveRecord::RecordNotFound
pp args
Resque::Failure.remove(count)
+ rescue Exception => e
+ puts "Job failed with error #{e.message}"
+ pp args
end
- desc "Run jobs in failure queue.
-Removes from queue if completes without exceptions OR if it gets RecordNotFound.
-Will not remove if there are other exceptions."
+ desc "Run jobs in failure queue.
+Removes them silently unless there are errors.
+If it gets RecordNotFound prints the args to the whenever log.
+If there are other exceptions prints out more information
+ but does not remove it from the queue.
+ These jobs will need to be removed manually."
task(:run_failures => :environment) do
(Resque::Failure.count-1).downto(0).each {|i| process_job(i)}
end