diff options
author | gord chung <gord@live.ca> | 2017-11-25 19:26:08 -0500 |
---|---|---|
committer | gord chung <gord@live.ca> | 2017-11-27 13:41:31 -0500 |
commit | 7c65038e79850b878187feb366ad2db0bc960572 (patch) | |
tree | 22cea2a6cab301721c580e5a349f3b77d436ac70 | |
parent | 02056bfb12f6fb87a47af177cb9d1c95376cad8c (diff) | |
download | oslo-messaging-7c65038e79850b878187feb366ad2db0bc960572.tar.gz |
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
-rw-r--r-- | oslo_messaging/notify/dispatcher.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/oslo_messaging/notify/dispatcher.py b/oslo_messaging/notify/dispatcher.py index caa80e0..83b3fe4 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 |