From 7c65038e79850b878187feb366ad2db0bc960572 Mon Sep 17 00:00:00 2001 From: gord chung Date: Sat, 25 Nov 2017 19:26:08 -0500 Subject: [PATCH] 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 --- oslo_messaging/notify/dispatcher.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/oslo_messaging/notify/dispatcher.py b/oslo_messaging/notify/dispatcher.py index caa80e05a..83b3fe469 100644 --- a/oslo_messaging/notify/dispatcher.py +++ b/oslo_messaging/notify/dispatcher.py @@ -125,8 +125,6 @@ class BatchNotificationDispatcher(NotificationDispatcher): requeues = set() for priority, messages in messages_grouped: __, raw_messages, messages = six.moves.zip(*messages) - raw_messages = list(raw_messages) - messages = list(messages) if priority not in PRIORITIES: LOG.warning(_LW('Unknown priority "%s"'), priority) continue @@ -141,7 +139,7 @@ class BatchNotificationDispatcher(NotificationDispatcher): message["metadata"], message["payload"])] else: - filtered_messages = messages + filtered_messages = list(messages) if not filtered_messages: continue