Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

updated resque failure rake task #484

Merged
merged 1 commit into from

2 participants

Sidra Elz
Sidra

need to rescue other failures than RecordNotFound or the task dies.

Sidra ambtus updated resque failure rake task
need to rescue other failures than RecordNotFound or the task dies.
97259e9
Elz elzj merged commit 0c7e31d into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 18, 2012
  1. Sidra

    updated resque failure rake task

    ambtus authored
    need to rescue other failures than RecordNotFound or the task dies.
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/tasks/resque.rake
12 lib/tasks/resque.rake
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
Something went wrong with that request. Please try again.