diff options
Diffstat (limited to 'kafka/consumer/group.py')
-rw-r--r-- | kafka/consumer/group.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kafka/consumer/group.py b/kafka/consumer/group.py index 3fb9c8e..704c994 100644 --- a/kafka/consumer/group.py +++ b/kafka/consumer/group.py @@ -441,7 +441,7 @@ class KafkaConsumer(six.Iterator): return records self._fetcher.init_fetches() - self._client.poll(timeout_ms / 1000.0) + self._client.poll(timeout_ms) return self._fetcher.fetched_records() def position(self, partition): @@ -628,11 +628,14 @@ class KafkaConsumer(six.Iterator): # init any new fetches (won't resend pending fetches) self._fetcher.init_fetches() - self._client.poll() + self._client.poll( + max(0, self._consumer_timeout - time.time()) * 1000) timeout_at = min(self._consumer_timeout, self._client._delayed_tasks.next_at() + time.time(), self._client.cluster.ttl() / 1000.0 + time.time()) + if time.time() > timeout_at: + continue for msg in self._fetcher: yield msg if time.time() > timeout_at: |