Last active
February 28, 2017 23:41
-
-
Save ajsharma/fdd9e91b9ddc0aeb45f6c2ce0ac5d065 to your computer and use it in GitHub Desktop.
Resque retry with prompt
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
# Prompt the user for each failed Resque job | |
# Respond with `y` to retry, otherwise it's skipped | |
def triage | |
# Pop jobs off the queue until there are no more | |
Resque::Failure.all( 0, 0 ).each.with_index do |job, index| | |
puts "JOB:" | |
pp job.except( "backtrace" ) | |
puts "Retry? ('y')" | |
input = gets.chomp.downcase | |
if "y" == input | |
Resque::Failure.requeue index | |
puts "pushed #{index}" | |
else | |
puts "not pushed #{index}" | |
end | |
puts | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WIP tweak to allow jobs to be removed