Skip to content

Commit 9df0789

Browse files
committed
Short-circuit lock acquire in conn.close()
1 parent 1a532ff commit 9df0789

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kafka/conn.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,8 @@ def close(self, error=None):
803803
will be failed with this exception.
804804
Default: kafka.errors.KafkaConnectionError.
805805
"""
806+
if self.state is ConnectionStates.DISCONNECTED:
807+
return
806808
with self._lock:
807809
if self.state is ConnectionStates.DISCONNECTED:
808810
return

0 commit comments

Comments
 (0)