Skip to content

Instantly share code, notes, and snippets.

@hirobo
Last active October 11, 2015 16:56
Show Gist options
  • Save hirobo/a7044d9c744f7a42ccec to your computer and use it in GitHub Desktop.
Save hirobo/a7044d9c744f7a42ccec to your computer and use it in GitHub Desktop.
# do only retry if not yet retried
def retry_failure
(Resque::Failure.count-1).downto(0).each do |i|
job = Resque::Failure.all(i, 1)
puts job['queue']
puts job['failed_at']
puts "retried_at: #{job['retried_at'].present?}"
puts job['error'][0..512]
if !job['retried_at'].present?
puts "requeue: #{i}"
Resque::Failure.requeue(i)
Resque::Failure.remove(i)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment