Merge "Improve the log to avoid unexpected ERROR"

This commit is contained in:
Jenkins 2016-05-30 06:50:38 +00:00 committed by Gerrit Code Review
commit dfa5493a73

View File

@ -37,19 +37,18 @@ class NotifierDriver(object):
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."""
if (self.subscription_controller and if self.subscription_controller:
not isinstance(self.subscription_controller, if not isinstance(self.subscription_controller,
pooling.SubscriptionController)): pooling.SubscriptionController):
subscribers = self.subscription_controller.list(queue_name, subscribers = self.subscription_controller.list(queue_name,
project) project)
for sub in next(subscribers):
for sub in next(subscribers): s_type = urllib_parse.urlparse(sub['subscriber']).scheme
s_type = urllib_parse.urlparse(sub['subscriber']).scheme data_driver = self.subscription_controller.driver
data_driver = self.subscription_controller.driver mgr = driver.DriverManager('zaqar.notification.tasks',
mgr = driver.DriverManager('zaqar.notification.tasks', s_type,
s_type, invoke_on_load=True)
invoke_on_load=True) self.executor.submit(mgr.driver.execute, sub, messages,
self.executor.submit(mgr.driver.execute, sub, messages, conf=data_driver.conf)
conf=data_driver.conf)
else: else:
LOG.error(_LE('Failed to get subscription controller.')) LOG.error(_LE('Failed to get subscription controller.'))