Skip to content

Instantly share code, notes, and snippets.

@joshm1
Created March 10, 2016 15:06
Show Gist options
  • Save joshm1/9c2dbd5275c9166abd49 to your computer and use it in GitHub Desktop.
Save joshm1/9c2dbd5275c9166abd49 to your computer and use it in GitHub Desktop.
Unregister stale resque workers
Resque.workers.each do |w|
matches = w.id.match(/^[^:]*:([0-9]*):[^:]*$/)
pid = matches[1]
is_real = w.worker_pids.include?(pid.to_s)
unless is_real
puts "unregister_worker pid=#{pid}"
w.unregister_worker
end
end; nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment