Skip to content

Commit e45b89b

Browse files
authored
Send pending requests before waiting for responses (#1762)
1 parent 8602389 commit e45b89b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kafka/client_async.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,10 @@ def _poll(self, timeout):
598598
# locked section of poll(), there is no additional lock acquisition here
599599
processed = set()
600600

601+
# Send pending requests first, before polling for responses
602+
for conn in six.itervalues(self._conns):
603+
conn.send_pending_requests()
604+
601605
start_select = time.time()
602606
ready = self._selector.select(timeout)
603607
end_select = time.time()
@@ -650,8 +654,6 @@ def _poll(self, timeout):
650654
conn.close(error=Errors.RequestTimedOutError(
651655
'Request timed out after %s ms' %
652656
conn.config['request_timeout_ms']))
653-
else:
654-
conn.send_pending_requests()
655657

656658
if self._sensors:
657659
self._sensors.io_time.record((time.time() - end_select) * 1000000000)

0 commit comments

Comments
 (0)