diff options
author | Dana Powers <dana.powers@gmail.com> | 2019-03-27 07:45:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-27 07:45:06 -0700 |
commit | e45b89bd676844fbc2115b56bbe23c250985005a (patch) | |
tree | 62ba21e2c5e3ae9f75137e1889b40043c04383f9 | |
parent | 8602389bbee5e99296a73700b76bd3e44f0fcf3b (diff) | |
download | kafka-python-e45b89bd676844fbc2115b56bbe23c250985005a.tar.gz |
Send pending requests before waiting for responses (#1762)
-rw-r--r-- | kafka/client_async.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kafka/client_async.py b/kafka/client_async.py index 682fd7c..0d9e562 100644 --- a/kafka/client_async.py +++ b/kafka/client_async.py @@ -598,6 +598,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() @@ -650,8 +654,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) |