From 1bca96ff782e967860c3ceb62bf25586be6df58c Mon Sep 17 00:00:00 2001 From: gordon chung Date: Wed, 17 Feb 2016 09:47:37 -0500 Subject: [PATCH] fix override_pool_size related to Id3af696193af2ccf5e5f3a1ae1d22f4f80860606. we need to make override_pool_size accessible for external use. Change-Id: I686c8c341f117dbc0b02443306395d5fd011c2f1 --- oslo_messaging/_executors/base.py | 2 +- oslo_messaging/server.py | 4 ++-- oslo_messaging/tests/rpc/test_server.py | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/oslo_messaging/_executors/base.py b/oslo_messaging/_executors/base.py index 7749c0087..4f0f58b7f 100644 --- a/oslo_messaging/_executors/base.py +++ b/oslo_messaging/_executors/base.py @@ -29,7 +29,7 @@ class ExecutorBase(object): self.dispatcher = dispatcher @abc.abstractmethod - def start(self): + def start(self, override_pool_size=None): """Start polling for incoming messages.""" @abc.abstractmethod diff --git a/oslo_messaging/server.py b/oslo_messaging/server.py index 78ccfa428..7f520c8ba 100644 --- a/oslo_messaging/server.py +++ b/oslo_messaging/server.py @@ -330,7 +330,7 @@ class MessageHandlingServer(service.ServiceBase, _OrderedTaskRunner): super(MessageHandlingServer, self).__init__() @ordered(reset_after='stop') - def start(self): + def start(self, override_pool_size=None): """Start handling incoming messages. This method causes the server to begin polling the transport for @@ -358,7 +358,7 @@ class MessageHandlingServer(service.ServiceBase, _OrderedTaskRunner): except driver_base.TransportDriverError as ex: raise ServerListenError(self.target, ex) executor = self._executor_cls(self.conf, listener, self.dispatcher) - executor.start() + executor.start(override_pool_size=override_pool_size) self._executor_obj = executor if self.executor == 'blocking': diff --git a/oslo_messaging/tests/rpc/test_server.py b/oslo_messaging/tests/rpc/test_server.py index b26938e1a..3dc158f45 100644 --- a/oslo_messaging/tests/rpc/test_server.py +++ b/oslo_messaging/tests/rpc/test_server.py @@ -553,7 +553,10 @@ class TestServerLocking(test_utils.BaseTestCase): self.listener = mock.MagicMock() executors.append(self) - start = _logmethod('start') + def start(self, override_pool_size=None): + with self._lock: + self._calls.append('start') + stop = _logmethod('stop') wait = _logmethod('wait') execute = _logmethod('execute') @@ -611,7 +614,7 @@ class TestServerLocking(test_utils.BaseTestCase): runner = [None] class SteppingFakeExecutor(self.server._executor_cls): - def start(self): + def start(self, override_pool_size=None): # Tell the test which thread won the race runner[0] = eventlet.getcurrent() running_event.set()