Created
June 25, 2014 20:32
-
-
Save myronmarston/fff6d87d204a7ad06bd0 to your computer and use it in GitHub Desktop.
Cancel all failed jobs in qless
This file contains hidden or 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 cancel_all_failed_jobs(redis) | |
qless = Qless::Client.new(redis: redis) | |
qless.jobs.failed.each do |key, count| | |
puts "#{key}: #{count}" | |
while (jobs = qless.jobs.failed(key, 0, 1000).fetch("jobs")).any? | |
qless.bulk_cancel(jobs.map(&:jid)) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment