diff --git a/kafka/client.py b/kafka/client.py index 7b04e711a..f8fe5556b 100644 --- a/kafka/client.py +++ b/kafka/client.py @@ -261,7 +261,7 @@ def get_partition_ids_for_topic(self, topic): if topic not in self.topic_partitions: return None - return list(self.topic_partitions[topic]) + return sorted(list(self.topic_partitions[topic])) def ensure_topic_exists(self, topic, timeout = 30): start_time = time.time()