summaryrefslogtreecommitdiff
path: root/kafka/client_async.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2019-03-22 09:05:58 -0700
committerDana Powers <dana.powers@gmail.com>2019-03-22 09:05:58 -0700
commit0cbb7be7f349913718fe6b0be751320fc2b49e41 (patch)
treef33f683d1ae4cdfba8084d7cdc5c2636a3141cbc /kafka/client_async.py
parentd032844ad945b6e99845c40cfe08e026a56d332a (diff)
downloadkafka-python-send_first_poll.tar.gz
Send pending requests before waiting for responsessend_first_poll
Diffstat (limited to 'kafka/client_async.py')
-rw-r--r--kafka/client_async.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/kafka/client_async.py b/kafka/client_async.py
index fa150db..dd48673 100644
--- a/kafka/client_async.py
+++ b/kafka/client_async.py
@@ -592,6 +592,10 @@ class KafkaClient(object):
# locked section of poll(), there is no additional lock acquisition here
processed = set()
+ # Send pending requests first, before polling for responses
+ for conn in six.itervalues(self._conns):
+ conn.send_pending_requests()
+
start_select = time.time()
ready = self._selector.select(timeout)
end_select = time.time()
@@ -644,8 +648,6 @@ class KafkaClient(object):
conn.close(error=Errors.RequestTimedOutError(
'Request timed out after %s ms' %
conn.config['request_timeout_ms']))
- else:
- conn.send_pending_requests()
if self._sensors:
self._sensors.io_time.record((time.time() - end_select) * 1000000000)