Skip to content

Instantly share code, notes, and snippets.

@stefanahman
Created September 10, 2018 10:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanahman/fa8b63f389e4f065e3c7910bcb42d3d4 to your computer and use it in GitHub Desktop.
Save stefanahman/fa8b63f389e4f065e3c7910bcb42d3d4 to your computer and use it in GitHub Desktop.
Remove jobs from Resque queues
# Active job
queue_name = 'netsuite_low'
class_name = 'PurchaseOrder::ImportSingleFromNetsuiteJob'
active_job_class = 'ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper'
# active_job_class = 'ActiveScheduler::ResqueWrapper'
args = Resque.peek(queue_name,0,10000).select { |job| job['args'].to_s.include?(class_name) }.flat_map{ |job| job['args'] }; nil
args.each { |arg| Resque::Job.destroy(queue_name, active_job_class, arg) }; nil
# Resque
queue_name = 'netsuite'
class_name = 'ImportSingleWardJob'
args = Resque.peek(queue_name,0,10000).select { |job| job['class'].to_s.include?(class_name) }.map{ |job| job['args'] }; nil
args.each { |arg| Resque::Job.destroy(queue_name, class_name, *arg) }; nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment