-
-
Save menporulporiayalan/271b205011fbe4ad63ad27d751638aaf to your computer and use it in GitHub Desktop.
Retry and clear failed Resque jobs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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