Merge "sort when using groupby"
This commit is contained in:
commit
c7eb5cac66
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
|
import operator
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
@ -118,9 +119,9 @@ class BatchNotificationDispatcher(NotificationDispatcher):
|
|||||||
"""Dispatch notification messages to the appropriate endpoint method.
|
"""Dispatch notification messages to the appropriate endpoint method.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
messages_grouped = itertools.groupby((
|
messages_grouped = itertools.groupby(sorted(
|
||||||
self._extract_user_message(m)
|
(self._extract_user_message(m) for m in incoming),
|
||||||
for m in incoming), lambda x: x[0])
|
key=operator.itemgetter(0)), operator.itemgetter(0))
|
||||||
|
|
||||||
requeues = set()
|
requeues = set()
|
||||||
for priority, messages in messages_grouped:
|
for priority, messages in messages_grouped:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user