don't convert generator to list unless required

there's only one scenario where the generator actually needs to be
forced into a list. don't waste time doing something unnecessary.

Change-Id: Iec897b1f6fed3d88b798eb673779e7c68ff930ec
This commit is contained in:
gord chung 2017-11-25 19:26:08 -05:00
parent 02056bfb12
commit 7c65038e79

View File

@ -125,8 +125,6 @@ class BatchNotificationDispatcher(NotificationDispatcher):
requeues = set() requeues = set()
for priority, messages in messages_grouped: for priority, messages in messages_grouped:
__, raw_messages, messages = six.moves.zip(*messages) __, raw_messages, messages = six.moves.zip(*messages)
raw_messages = list(raw_messages)
messages = list(messages)
if priority not in PRIORITIES: if priority not in PRIORITIES:
LOG.warning(_LW('Unknown priority "%s"'), priority) LOG.warning(_LW('Unknown priority "%s"'), priority)
continue continue
@ -141,7 +139,7 @@ class BatchNotificationDispatcher(NotificationDispatcher):
message["metadata"], message["metadata"],
message["payload"])] message["payload"])]
else: else:
filtered_messages = messages filtered_messages = list(messages)
if not filtered_messages: if not filtered_messages:
continue continue