Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do network connections and writes in KafkaClient.poll() #1729

Merged
merged 6 commits into from
Mar 8, 2019
Prev Previous commit
Remove sleep check when no partitions assigned -- no longer needed
  • Loading branch information
dpkp authored and jeffwidman committed Mar 8, 2019
commit 0a8914ff0e9e5896b761127b82b5aac613d3e4c0
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