Created
March 17, 2009 20:20
-
-
Save tmm1/80747 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| diff --git a/lib/nanite/agent.rb b/lib/nanite/agent.rb | |
| index 8cb8900..87da714 100644 | |
| --- a/lib/nanite/agent.rb | |
| +++ b/lib/nanite/agent.rb | |
| @@ -178,17 +178,21 @@ module Nanite | |
| def setup_traps | |
| ['INT', 'TERM'].each do |sig| | |
| - trap(sig) do | |
| + old = trap(sig) do | |
| un_register | |
| - EM.add_timer(0.1) do | |
| + amq.instance_variable_get('@connection').close do | |
| EM.stop | |
| + old.call if old.is_a? Proc | |
| end | |
| end | |
| end | |
| end | |
| def un_register | |
| - amq.fanout('registration', :no_declare => options[:secure]).publish(serializer.dump(UnRegister.new(identity))) | |
| + unless @unregistered | |
| + @unregistered = true | |
| + amq.fanout('registration', :no_declare => options[:secure]).publish(serializer.dump(UnRegister.new(identity))) | |
| + end | |
| end | |
| def advertise_services | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment