config/initializers/isono.rb in wakame-vdc-dcmgr-10.12.0 vs config/initializers/isono.rb in wakame-vdc-dcmgr-11.06.0

- old
+ new

@@ -3,36 +3,20 @@ require 'isono' require 'eventmachine' Signal.trap('EXIT') { EventMachine.stop } -if defined?(PhusionPassenger) - if PhusionPassenger::VERSION_STRING =~ /^3\.0\./ - blk = proc { |forked| - if EventMachine.reactor_running? - EventMachine.stop - Dcmgr.class_eval { - @messaging_client = nil - } - end - Thread.new { EventMachine.epoll; EventMachine.run; } +def restart_reactor_and_messaging_client + if EventMachine.reactor_running? + EventMachine.stop + Dcmgr.class_eval { + @messaging_client = nil } - else - blk = proc { - if EventMachine.reactor_running? - EventMachine.stop - Dcmgr.class_eval { - @messaging_client = nil - } - end - Thread.new { EventMachine.epoll; EventMachine.run; } - } end - PhusionPassenger.on_event(:starting_worker_process, &blk) -else - EventMachine.stop if EventMachine.reactor_running? Thread.new { EventMachine.epoll; EventMachine.run; } end + +restart_reactor_and_messaging_client Dcmgr.class_eval { def self.messaging @messaging_client ||= Isono::MessagingClient.start(conf.amqp_server_uri) do node_name 'dcmgr'