View The Space is Hiring

Sunday, June 5, 2011

Clean Resque Workers from a Terminated Host

Situation: A host that used to have resque workers running has been terminated and information about those workers still appears within resque web.

Solution: The unregister_workers_for_host method below.

module Resque
def self.unregister_workers_for_host(host)
Resque.workers.select{|worker| worker.id.split(':').first==host}.each(&:unregister_worker)
end
end
Resque.unregister_workers_for_host("ip-10-250-192-51")
view raw gistfile1.rb hosted with ❤ by GitHub

No comments:

Post a Comment