summaryrefslogtreecommitdiff
path: root/kafka
diff options
context:
space:
mode:
Diffstat (limited to 'kafka')
-rw-r--r--kafka/client_async.py11
-rw-r--r--kafka/consumer/group.py2
2 files changed, 7 insertions, 6 deletions
diff --git a/kafka/client_async.py b/kafka/client_async.py
index 1838aed..1c74c6f 100644
--- a/kafka/client_async.py
+++ b/kafka/client_async.py
@@ -314,11 +314,12 @@ class KafkaClient(object):
else:
task_future.success(result)
- task_timeout_ms = max(0, 1000 * (
- self._delayed_tasks.next_at() - time.time()))
- timeout = min(timeout_ms, metadata_timeout_ms, task_timeout_ms,
- self.config['request_timeout_ms'])
- timeout /= 1000.0
+ timeout = min(
+ timeout_ms,
+ metadata_timeout_ms,
+ self._delayed_tasks.next_at() * 1000,
+ self.config['request_timeout_ms'])
+ timeout = max(0, timeout / 1000.0)
responses.extend(self._poll(timeout))
if not future or future.is_done:
diff --git a/kafka/consumer/group.py b/kafka/consumer/group.py
index 75fe3ee..3fb9c8e 100644
--- a/kafka/consumer/group.py
+++ b/kafka/consumer/group.py
@@ -631,7 +631,7 @@ class KafkaConsumer(six.Iterator):
self._client.poll()
timeout_at = min(self._consumer_timeout,
- self._client._delayed_tasks.next_at(),
+ self._client._delayed_tasks.next_at() + time.time(),
self._client.cluster.ttl() / 1000.0 + time.time())
for msg in self._fetcher:
yield msg