Created
June 30, 2011 08:22
-
-
Save pivotalneutron/1055856 to your computer and use it in GitHub Desktop.
Removing stale resque workers from Redis
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
# When resque workers are no longer around, but records of them are still sitting around in Redis... | |
def remove_resque_workers worker, ips | |
ips.each do |ip| | |
eval(" | |
def worker.to_s | |
'#{ip}:*' | |
end | |
") | |
worker.unregister_worker | |
end | |
end | |
ips = ["ip1:pid", "ip2:pid"] | |
worker = Resque::Worker.new('*') | |
remove_resque_workers worker, ips |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment