summaryrefslogtreecommitdiff
path: root/kafka/client.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@rd.io>2015-04-05 19:36:25 -0700
committerDana Powers <dana.powers@rd.io>2015-04-12 10:46:17 -0700
commitfbc242fac09e3913b3e5a7bb73b0440da1bc2c11 (patch)
treee7b3b33897598162b35cdc28e0be612eec3ebcf4 /kafka/client.py
parent04a38169590224decbcbe7ef49a52b7ea44b20a8 (diff)
downloadkafka-python-fbc242fac09e3913b3e5a7bb73b0440da1bc2c11.tar.gz
Simplify client.reset_topic_metadata
Diffstat (limited to 'kafka/client.py')
-rw-r--r--kafka/client.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/kafka/client.py b/kafka/client.py
index 4cd9e24..a966f92 100644
--- a/kafka/client.py
+++ b/kafka/client.py
@@ -243,15 +243,11 @@ class KafkaClient(object):
def reset_topic_metadata(self, *topics):
for topic in topics:
- try:
- partitions = self.topic_partitions[topic]
- except KeyError:
- continue
-
- for partition in partitions:
- self.topics_to_brokers.pop(TopicAndPartition(topic, partition), None)
-
- del self.topic_partitions[topic]
+ for topic_partition in list(self.topics_to_brokers.keys()):
+ if topic_partition.topic == topic:
+ del self.topics_to_brokers[topic_partition]
+ if topic in self.topic_partitions:
+ del self.topic_partitions[topic]
def reset_all_metadata(self):
self.topics_to_brokers.clear()