Skip to content

Commit 422189b

Browse files
authored
Select on sockets to avoid busy polling during bootstrap (#1175)
1 parent 8cf4484 commit 422189b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kafka/client_async.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,14 @@ def _bootstrap(self, hosts):
245245
**self.config)
246246
bootstrap.connect()
247247
while bootstrap.connecting():
248+
self._selector.select(1)
248249
bootstrap.connect()
249250
if not bootstrap.connected():
250251
bootstrap.close()
251252
continue
252253
future = bootstrap.send(metadata_request)
253254
while not future.is_done:
255+
self._selector.select(1)
254256
bootstrap.recv()
255257
if future.failed():
256258
bootstrap.close()

0 commit comments

Comments
 (0)