Skip to content

Instantly share code, notes, and snippets.

@roadhouse
Last active February 14, 2020 22:45
Show Gist options
  • Save roadhouse/edaab7f8594ef39073902431249bae0a to your computer and use it in GitHub Desktop.
Save roadhouse/edaab7f8594ef39073902431249bae0a to your computer and use it in GitHub Desktop.
real=Sidekiq::Queue.new('realtime')
jobs= real.group_by {|i| i.args}
jobs.delete_if {|k,v| v.size == 1}
jobs.map {|k,v| v[0..(v.size-2)].map {|i| i.delete }}
workers = Sidekiq::Workers.new
workers.each { |process_id, thread_id, work| p 'jean' if Time.at(work['run_at']).to_datetime < 1.hour.ago}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment