From 84c65b371191c1666a670cfa5e35aa27b35f85cd Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Sat, 12 Aug 2017 16:36:04 -0700 Subject: [PATCH] Select on sockets to avoid busy polling during bootstrap --- kafka/client_async.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kafka/client_async.py b/kafka/client_async.py index 5308c1f9e..ecd2ceac7 100644 --- a/kafka/client_async.py +++ b/kafka/client_async.py @@ -245,12 +245,14 @@ def _bootstrap(self, hosts): **self.config) bootstrap.connect() while bootstrap.connecting(): + self._selector.select(1) bootstrap.connect() if not bootstrap.connected(): bootstrap.close() continue future = bootstrap.send(metadata_request) while not future.is_done: + self._selector.select(1) bootstrap.recv() if future.failed(): bootstrap.close()