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):
|
def __init__(self, *args, **kwargs):
|
||||||
self.subscription_controller = kwargs.get('subscription_controller')
|
self.subscription_controller = kwargs.get('subscription_controller')
|
||||||
try:
|
# TODO(flwang): Make the max_workers configurable
|
||||||
self.executor = futurist.GreenThreadPoolExecutor()
|
self.executor = futurist.ThreadPoolExecutor(max_workers=10)
|
||||||
except RuntimeError:
|
|
||||||
# TODO(flwang): Make the max_workers configurable
|
|
||||||
self.executor = futurist.ThreadPoolExecutor(max_workers=10)
|
|
||||||
|
|
||||||
def post(self, queue_name, messages, client_uuid, project=None):
|
def post(self, queue_name, messages, client_uuid, project=None):
|
||||||
"""Send messages to the subscribers."""
|
"""Send messages to the subscribers."""
|
||||||
|
@ -51,6 +51,7 @@ class NotifierTest(testing.TestBase):
|
|||||||
with mock.patch('requests.post') as mock_post:
|
with mock.patch('requests.post') as mock_post:
|
||||||
self.driver.post('fake_queue', self.messages,
|
self.driver.post('fake_queue', self.messages,
|
||||||
self.client_id, self.project)
|
self.client_id, self.project)
|
||||||
|
self.driver.executor.shutdown()
|
||||||
mock_post.assert_has_calls([
|
mock_post.assert_has_calls([
|
||||||
mock.call(self.subscription[0]['subscriber'],
|
mock.call(self.subscription[0]['subscriber'],
|
||||||
data=json.dumps(self.messages[0]),
|
data=json.dumps(self.messages[0]),
|
||||||
|
Loading…
Reference in New Issue
Block a user