Skip to content

Instantly share code, notes, and snippets.

@pivotalneutron
Created June 30, 2011 08:22
Show Gist options
  • Save pivotalneutron/1055856 to your computer and use it in GitHub Desktop.
Save pivotalneutron/1055856 to your computer and use it in GitHub Desktop.
Removing stale resque workers from Redis
# 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