ensure dispatcher service is configured before rpc

there is a rare race condition where when the mq contains
notifications, the rpc service is configured before dispatcher so
it may attempt to start sending messages to dispatcher before it
has been configured. this patch ensures the dispatcher
configuration is done before starting rpc service.

Change-Id: If4c3a225e0bd5ae6eefad072b844af1ef5786f3f
This commit is contained in:
Gordon Chung 2014-03-27 17:38:40 -04:00
parent e8a7eed15c
commit 5df14763a5
1 changed files with 2 additions and 1 deletions

View File

@ -107,7 +107,6 @@ class DispatchedService(object):
DISPATCHER_NAMESPACE = 'ceilometer.dispatcher'
def start(self):
super(DispatchedService, self).start()
LOG.debug(_('loading dispatchers from %s'),
self.DISPATCHER_NAMESPACE)
self.dispatcher_manager = named.NamedExtensionManager(
@ -118,6 +117,8 @@ class DispatchedService(object):
if not list(self.dispatcher_manager):
LOG.warning(_('Failed to load any dispatchers for %s'),
self.DISPATCHER_NAMESPACE)
# ensure dispatcher is configured before starting other services
super(DispatchedService, self).start()
def get_workers(name):