Skip to content

Instantly share code, notes, and snippets.

@esaul
Created February 17, 2012 17:13
Show Gist options
  • Save esaul/1854433 to your computer and use it in GitHub Desktop.
Save esaul/1854433 to your computer and use it in GitHub Desktop.
Retry and clear failed Resque jobs
def retry_and_clear(args)
case args
when Integer
Resque::Failure.requeue(args)
Resque::Failure.remove(args)
when String
all_jobs = Resque::Failure.all(0, Resque::Failure.count)
all_jobs.each_with_index do |job, idx|
begin
Resque::Failure.requeue(idx)
Resque::Failure.remove(idx)
rescue StandardError => e
end if job['payload'] && job['payload']['class'] == args
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment