Skip to content

Commit

Permalink
Check for immediate failure when looking up coordinator in heartbeat …
Browse files Browse the repository at this point in the history
…thread (dpkp#1457)
  • Loading branch information
dpkp authored and 88manpreet committed Aug 1, 2018
1 parent 12d2765 commit e8ccee7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kafka/coordinator/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,11 @@ def _run_once(self):
self.coordinator._client.poll(timeout_ms=0)

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

elif self.coordinator.heartbeat.session_timeout_expired():
Expand Down

0 comments on commit e8ccee7

Please sign in to comment.