Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save menporulporiayalan/271b205011fbe4ad63ad27d751638aaf to your computer and use it in GitHub Desktop.
Save menporulporiayalan/271b205011fbe4ad63ad27d751638aaf 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