Skip to content

Commit 3fd7d09

Browse files
committed
Remove sleep check when no partitions assigned -- no longer needed
1 parent 435111d commit 3fd7d09

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

kafka/consumer/group.py

-10
Original file line numberDiff line numberDiff line change
@@ -1070,16 +1070,6 @@ def _message_generator(self):
10701070
# like heartbeats, auto-commits, and metadata refreshes
10711071
timeout_at = self._next_timeout()
10721072

1073-
# Because the consumer client poll does not sleep unless blocking on
1074-
# network IO, we need to explicitly sleep when we know we are idle
1075-
# because we haven't been assigned any partitions to fetch / consume
1076-
if self._use_consumer_group() and not self.assignment():
1077-
sleep_time = max(timeout_at - time.time(), 0)
1078-
if sleep_time > 0 and not self._client.in_flight_request_count():
1079-
log.debug('No partitions assigned; sleeping for %s', sleep_time)
1080-
time.sleep(sleep_time)
1081-
continue
1082-
10831073
# Short-circuit the fetch iterator if we are already timed out
10841074
# to avoid any unintentional interaction with fetcher setup
10851075
if time.time() > timeout_at:

0 commit comments

Comments
 (0)