Browse files

updated resque failure rake task

need to rescue other failures than RecordNotFound or the task dies.
  • Loading branch information...
1 parent 0858526 commit 97259e9efd4744ff5377ffa64381b10ba88bcba6 @ambtus committed Feb 18, 2012
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/tasks/resque.rake
@@ -10,11 +10,17 @@ namespace :resque do
rescue ActiveRecord::RecordNotFound
pp args
+ rescue Exception => e
+ puts "Job failed with error #{e.message}"
+ pp args
- 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)}

0 comments on commit 97259e9

Please sign in to comment.