Skip to content

Commit 1a1cc04

Browse files
committed
only acquire coordinator lock in heartbeat thread close if not self thread
1 parent e5025c8 commit 1a1cc04

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kafka/coordinator/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,15 +923,16 @@ def close(self):
923923
if self.closed:
924924
return
925925
self.closed = True
926-
with self.coordinator._lock:
927-
self.coordinator._lock.notify()
928926

929927
# Generally this should not happen - close() is triggered
930928
# by the coordinator. But in some cases GC may close the coordinator
931929
# from within the heartbeat thread.
932930
if threading.current_thread() == self:
933931
return
934932

933+
with self.coordinator._lock:
934+
self.coordinator._lock.notify()
935+
935936
if self.is_alive():
936937
self.join(self.coordinator.config['heartbeat_interval_ms'] / 1000)
937938
if self.is_alive():

0 commit comments

Comments
 (0)