Skip to content

Commit c662d94

Browse files
keejonrushidave
authored andcommitted
bugfix: catch KeyError in check_version and retry
1 parent 1a6bf01 commit c662d94

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

kafka/client_async.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,13 @@ def check_version(self, node_id=None, timeout=2, strict=False):
912912
self._lock.release()
913913
raise Errors.NoBrokersAvailable()
914914
self._maybe_connect(try_node)
915-
conn = self._conns[try_node]
915+
try:
916+
conn = self._conns[try_node]
917+
except KeyError:
918+
if node_id is not None:
919+
self._lock.release()
920+
raise Errors.NodeNotReadyError()
921+
continue
916922

917923
# We will intentionally cause socket failures
918924
# These should not trigger metadata refresh

0 commit comments

Comments
 (0)