Merge "Use thread executor all the time for notifier"

This commit is contained in:
Jenkins 2015-09-02 21:35:01 +00:00 committed by Gerrit Code Review
commit 243a55ee0b
2 changed files with 3 additions and 5 deletions

View File

@ -29,11 +29,8 @@ class NotifierDriver(object):
def __init__(self, *args, **kwargs):
self.subscription_controller = kwargs.get('subscription_controller')
try:
self.executor = futurist.GreenThreadPoolExecutor()
except RuntimeError:
# TODO(flwang): Make the max_workers configurable
self.executor = futurist.ThreadPoolExecutor(max_workers=10)
# TODO(flwang): Make the max_workers configurable
self.executor = futurist.ThreadPoolExecutor(max_workers=10)
def post(self, queue_name, messages, client_uuid, project=None):
"""Send messages to the subscribers."""

View File

@ -51,6 +51,7 @@ class NotifierTest(testing.TestBase):
with mock.patch('requests.post') as mock_post:
self.driver.post('fake_queue', self.messages,
self.client_id, self.project)
self.driver.executor.shutdown()
mock_post.assert_has_calls([
mock.call(self.subscription[0]['subscriber'],
data=json.dumps(self.messages[0]),