Merge "Use thread executor all the time for notifier"
This commit is contained in:
commit
243a55ee0b
@ -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."""
|
||||
|
@ -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]),
|
||||
|
Loading…
Reference in New Issue
Block a user