Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Created June 25, 2014 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save myronmarston/fff6d87d204a7ad06bd0 to your computer and use it in GitHub Desktop.
Save myronmarston/fff6d87d204a7ad06bd0 to your computer and use it in GitHub Desktop.
Cancel all failed jobs in qless
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