diff options
author | Dana Powers <dana.powers@rd.io> | 2015-04-05 19:38:18 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@rd.io> | 2015-04-12 10:46:17 -0700 |
commit | d5c9a11a574f06a1c9dd7ac4a98d0dc30452480c (patch) | |
tree | 365e3304be07afa9d92dcb636fba6edf66a22e65 /kafka/client.py | |
parent | fbc242fac09e3913b3e5a7bb73b0440da1bc2c11 (diff) | |
download | kafka-python-d5c9a11a574f06a1c9dd7ac4a98d0dc30452480c.tar.gz |
clean local metadata before requesting refresh in load_metadata_for_topics()
Diffstat (limited to 'kafka/client.py')
-rw-r--r-- | kafka/client.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kafka/client.py b/kafka/client.py index a966f92..f01c1c5 100644 --- a/kafka/client.py +++ b/kafka/client.py @@ -311,6 +311,13 @@ class KafkaClient(object): (a single partition w/o a leader, for example) """ topics = [kafka_bytestring(t) for t in topics] + + if topics: + for topic in topics: + self.reset_topic_metadata(topic) + else: + self.reset_all_metadata() + resp = self.send_metadata_request(topics) log.debug("Broker metadata: %s", resp.brokers) @@ -323,8 +330,6 @@ class KafkaClient(object): topic = topic_metadata.topic partitions = topic_metadata.partitions - self.reset_topic_metadata(topic) - # Errors expected for new topics try: kafka.common.check_error(topic_metadata) |