Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions kafka/coordinator/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,8 @@ def __del__(self):
def close(self):
"""Close the coordinator, leave the current group,
and reset local generation / member_id"""
with self._client._lock, self._lock:
self._close_heartbeat_thread()
self.maybe_leave_group()
self._close_heartbeat_thread()
self.maybe_leave_group()

def maybe_leave_group(self):
"""Leave the current group and reset local generation/memberId."""
Expand Down Expand Up @@ -918,6 +917,10 @@ def close(self):
self.closed = True
with self.coordinator._lock:
self.coordinator._lock.notify()
if self.is_alive():
self.join(self.coordinator.config['heartbeat_interval_ms'] / 1000)
if self.is_alive():
log.warning("Heartbeat thread did not fully terminate during close")

def run(self):
try:
Expand Down