control_bus service has only 1 heartbeat thread

control_service class expects to have only one heartbeat thread.
But the service launchs a heartbeat thread everytime when
control_bus.start() is called. Thus control_bus has 3 methods
and sends 3 heartbeat messages always.

This adds a barrier to stop creating extra heartbeat threads in the class.

Change-Id: I28f06eef3548e07367a3c3757892112a87391ce5
Closes-Bug: #1622865
This commit is contained in:
Masahito Muroi 2016-09-16 02:20:35 +09:00
parent 40b3b3473b
commit 3785f810b5
2 changed files with 6 additions and 1 deletions

View File

@ -146,6 +146,10 @@ class DseNodeControlBus(data_service.DataService):
# Note(thread-safety): blocking function
def start(self):
if self._running:
LOG.debug('control bus on %s already started.' % self.node.node_id)
return
LOG.debug("<%s> Starting DSE control bus", self.node.node_id)
super(DseNodeControlBus, self).start()

View File

@ -174,7 +174,8 @@ class DseNode(object):
self.transport, service._target, service.rpc_endpoints(),
executor='eventlet')
service.start()
if self._running:
service.start()
LOG.debug('<%s> Service %s RPC Server listening on %s',
self.node_id, service.service_id, service._target)