Sha256: 569c8ff393a2706e91e2cf8e4581aa5cc99eaf8a2cedeb1c3cd6dc6245d7db24

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

# -*- coding: utf-8 -*-

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; }
    }
  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

Dcmgr.class_eval {
  def self.messaging
    @messaging_client ||= Isono::MessagingClient.start(conf.amqp_server_uri) do
      node_name 'dcmgr'
      node_instance_id "#{Isono::Util.default_gw_ipaddr}:#{Process.pid}"
    end
  end
}

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
wakame-vdc-dcmgr-10.12.0 config/initializers/isono.rb
wakame-vdc-agents-10.12.0 config/initializers/isono.rb
wakame-vdc-dcmgr-10.11.0 config/initializers/isono.rb
wakame-vdc-agents-10.11.0 config/initializers/isono.rb