Removing wait() when initializing notification listener

According to [1],the correct usage is to call stop() before wait(), so in
mistral case, we should never call stop() and wait() in initialization of
engine and executor service.

[1]:
http://docs.openstack.org/developer/oslo.messaging/notification_listener.html

Change-Id: Ic6a802bff35a6a6fdfadf38474782efd12fd34d8
Closes-Bug: #1514459
This commit is contained in:
Lingxian Kong 2015-11-09 22:47:29 +08:00
parent 15a5ad3929
commit ec28a305d9
2 changed files with 39 additions and 8 deletions

View File

@ -25,6 +25,7 @@ eventlet.monkey_patch(
time=True)
import os
import time
# If ../mistral/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
@ -76,8 +77,16 @@ def launch_executor(transport):
executor_v2.register_membership()
server.start()
server.wait()
try:
server.start()
while True:
time.sleep(604800)
except (KeyboardInterrupt, SystemExit):
pass
finally:
print("Stopping executor service...")
server.stop()
server.wait()
def launch_engine(transport):
@ -107,8 +116,16 @@ def launch_engine(transport):
engine_v2.register_membership()
server.start()
server.wait()
try:
server.start()
while True:
time.sleep(604800)
except (KeyboardInterrupt, SystemExit):
pass
finally:
print("Stopping engine service...")
server.stop()
server.wait()
def launch_api(transport):

View File

@ -44,8 +44,15 @@ def launch_engine_server(transport, engine):
serializer=ctx.RpcContextSerializer(ctx.JsonPayloadSerializer())
)
server.start()
server.wait()
try:
server.start()
while True:
eventlet.sleep(604800)
except (KeyboardInterrupt, SystemExit):
LOG.info("Stopping engine service...")
finally:
server.stop()
server.wait()
def launch_executor_server(transport, executor):
@ -62,8 +69,15 @@ def launch_executor_server(transport, executor):
serializer=ctx.RpcContextSerializer(ctx.JsonPayloadSerializer())
)
server.start()
server.wait()
try:
server.start()
while True:
eventlet.sleep(604800)
except (KeyboardInterrupt, SystemExit):
LOG.info("Stopping executor service...")
finally:
server.stop()
server.wait()
class EngineTestCase(base.DbTestCase):