Skip to content

Instantly share code, notes, and snippets.

@waynehuang13
Forked from PatrickTulskie/resque_retry.rb
Created May 2, 2014 05:22
Show Gist options
  • Select an option

  • Save waynehuang13/9606f195aaa359c3a87a to your computer and use it in GitHub Desktop.

Select an option

Save waynehuang13/9606f195aaa359c3a87a to your computer and use it in GitHub Desktop.

Revisions

  1. Clemens Kofler created this gist Jun 24, 2011.
    12 changes: 12 additions & 0 deletions resque_retry.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    # inspired by http://ariejan.net/2010/08/23/resque-how-to-requeue-failed-jobs

    # retry all failed Resque jobs except the ones that have already been retried
    # This is, for instance, useful if you have already retried some jobs via the web interface.
    Resque::Failure.count.times do |i|
    Resque::Failure.requeue(i) unless Resque::Failure.all(i, 1)['retried_at'].present?
    end

    # retry all :)
    Resque::Failure.count.times do |i|
    Resque::Failure.requeue(i)
    end