Merge "[zmq] Support KeyboardInterrupt for broker"

This commit is contained in:
Jenkins
2016-01-26 21:41:43 +00:00
committed by Gerrit Code Review
2 changed files with 6 additions and 4 deletions

View File

@@ -15,6 +15,7 @@
import contextlib
import logging
import sys
import time
from oslo_config import cfg
@@ -25,8 +26,6 @@ from oslo_messaging._executors import impl_pooledexecutor
CONF = cfg.CONF
CONF.register_opts(impl_zmq.zmq_opts)
CONF.register_opts(impl_pooledexecutor._pool_opts)
# TODO(ozamiatin): Move this option assignment to an external config file
# Use efficient zmq poller in real-world deployment
CONF.rpc_zmq_native = True
@@ -36,7 +35,9 @@ def main():
with contextlib.closing(zmq_broker.ZmqBroker(CONF)) as reactor:
reactor.start()
reactor.wait()
while True:
time.sleep(1)
if __name__ == "__main__":
main()

View File

@@ -85,13 +85,14 @@ class ThreadingExecutor(zmq_poller.Executor):
self._method()
def execute(self):
self.thread.daemon = True
self.thread.start()
def stop(self):
self._stop.set()
def wait(self):
self.thread.join()
pass
def done(self):
self._stop.set()