From 3fd7d093f41f6f4381494e9588025a71e02e8987 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Wed, 6 Mar 2019 08:03:36 -0800 Subject: [PATCH] Remove sleep check when no partitions assigned -- no longer needed --- kafka/consumer/group.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/kafka/consumer/group.py b/kafka/consumer/group.py index 5f06e7b5f..531c1072a 100644 --- a/kafka/consumer/group.py +++ b/kafka/consumer/group.py @@ -1070,16 +1070,6 @@ def _message_generator(self): # like heartbeats, auto-commits, and metadata refreshes timeout_at = self._next_timeout() - # Because the consumer client poll does not sleep unless blocking on - # network IO, we need to explicitly sleep when we know we are idle - # because we haven't been assigned any partitions to fetch / consume - if self._use_consumer_group() and not self.assignment(): - sleep_time = max(timeout_at - time.time(), 0) - if sleep_time > 0 and not self._client.in_flight_request_count(): - log.debug('No partitions assigned; sleeping for %s', sleep_time) - time.sleep(sleep_time) - continue - # Short-circuit the fetch iterator if we are already timed out # to avoid any unintentional interaction with fetcher setup if time.time() > timeout_at: