diff options
author | Mahendra M <mahendra.m@gmail.com> | 2013-06-13 14:40:09 +0530 |
---|---|---|
committer | Mahendra M <mahendra.m@gmail.com> | 2013-06-13 14:40:09 +0530 |
commit | d3cf18a9fb961f8c640bd2ff0384b9a66ae179bb (patch) | |
tree | ff11ce0a1bf8770ae60cc8fe1026d097c84e8d26 /kafka/client.py | |
parent | ac76520bf880fb91e76d34a8e67cbe7e96017c7d (diff) | |
download | kafka-python-d3cf18a9fb961f8c640bd2ff0384b9a66ae179bb.tar.gz |
Fix bugs and testing
* Ensure that round-robin partitioner works fine
* _load_metadata_for_topics() would cause duplicate and stale entries in
self.topic_partitions. Fix this
Diffstat (limited to 'kafka/client.py')
-rw-r--r-- | kafka/client.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kafka/client.py b/kafka/client.py index 5595d49..1146798 100644 --- a/kafka/client.py +++ b/kafka/client.py @@ -73,7 +73,12 @@ class KafkaClient(object): self.brokers.update(brokers) self.topics_to_brokers = {} + for topic, partitions in topics.items(): + # Clear the list once before we add it. This removes stale entries + # and avoids duplicates + self.topic_partitions.pop(topic, None) + if not partitions: log.info("Partition is unassigned, delay for 1s and retry") time.sleep(1) |