summaryrefslogtreecommitdiff
path: root/kafka
diff options
context:
space:
mode:
authormrtheb <mrlabbe@gmail.com>2014-01-18 09:27:08 -0500
committermrtheb <mrlabbe@gmail.com>2014-01-18 09:27:08 -0500
commit6189bd46951580f1c0e280d289ab90dfc7d70b37 (patch)
treec63fdc0027da19fe994e9e98124f2a784c13e847 /kafka
parent6db14de1673dac9164f8774efdcf01abc2e1a7fb (diff)
downloadkafka-python-6189bd46951580f1c0e280d289ab90dfc7d70b37.tar.gz
added mock
Diffstat (limited to 'kafka')
-rw-r--r--kafka/client.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/kafka/client.py b/kafka/client.py
index 155f658..e6b3ca9 100644
--- a/kafka/client.py
+++ b/kafka/client.py
@@ -243,9 +243,10 @@ class KafkaClient(object):
self.topic_partitions[topic] = []
for partition, meta in partitions.items():
- topic_part = TopicAndPartition(topic, partition)
- self.topics_to_brokers[topic_part] = brokers[meta.leader]
- self.topic_partitions[topic].append(partition)
+ if meta.leader != -1:
+ topic_part = TopicAndPartition(topic, partition)
+ self.topics_to_brokers[topic_part] = brokers[meta.leader]
+ self.topic_partitions[topic].append(partition)
def send_produce_request(self, payloads=[], acks=1, timeout=1000,
fail_on_error=True, callback=None):