Skip to content

Commit 204388b

Browse files
authored
Check for immediate failure when looking up coordinator in heartbeat thread (#1457)
1 parent e8cb888 commit 204388b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

kafka/coordinator/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,11 @@ def _run_once(self):
945945
self.coordinator._client.poll(timeout_ms=0)
946946

947947
if self.coordinator.coordinator_unknown():
948-
if not self.coordinator.lookup_coordinator().is_done:
948+
future = self.coordinator.lookup_coordinator()
949+
if not future.is_done or future.failed():
950+
# the immediate future check ensures that we backoff
951+
# properly in the case that no brokers are available
952+
# to connect to (and the future is automatically failed).
949953
self.coordinator._lock.wait(self.coordinator.config['retry_backoff_ms'] / 1000)
950954

951955
elif self.coordinator.heartbeat.session_timeout_expired():

0 commit comments

Comments
 (0)