Created
March 10, 2016 15:06
-
-
Save joshm1/9c2dbd5275c9166abd49 to your computer and use it in GitHub Desktop.
Unregister stale resque workers
This file contains 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
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