Skip to content

Commit

Permalink
Remove sleep check when no partitions assigned -- no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
dpkp committed Mar 6, 2019
1 parent 435111d commit 3fd7d09
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions kafka/consumer/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3fd7d09

Please sign in to comment.