From 8c6ac80fa368732cac061993a81c363fbbad662c Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Fri, 12 Jan 2018 09:38:32 -0800 Subject: set.discard is much better --- kafka/consumer/fetcher.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'kafka') diff --git a/kafka/consumer/fetcher.py b/kafka/consumer/fetcher.py index 0c3b84c..afb8f52 100644 --- a/kafka/consumer/fetcher.py +++ b/kafka/consumer/fetcher.py @@ -638,11 +638,9 @@ class Fetcher(six.Iterator): def _fetchable_partitions(self): fetchable = self._subscriptions.fetchable_partitions() if self._next_partition_records: - if self._next_partition_records.topic_partition in fetchable: - fetchable.remove(self._next_partition_records.topic_partition) + fetchable.discard(self._next_partition_records.topic_partition) for fetch in self._completed_fetches: - if fetch.topic_partition in fetchable: - fetchable.remove(fetch.topic_partition) + fetchable.discard(fetch.topic_partition) return fetchable def _create_fetch_requests(self): -- cgit v1.2.1