Skip to content

Commit

Permalink
Always call _safe_close() on KazooClient.stop() so we don't leak work…
Browse files Browse the repository at this point in the history
…er threads
  • Loading branch information
josephaltmaier committed Mar 1, 2017
1 parent b77d8de commit fa47be4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kazoo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,10 @@ def stop(self):

self._stopped.set()
self._queue.append((CloseInstance, None))
self._connection._write_sock.send(b'\0')
self._safe_close()
try:
self._connection._write_sock.send(b'\0')
finally:
self._safe_close()

def restart(self):
"""Stop and restart the Zookeeper session."""
Expand Down

0 comments on commit fa47be4

Please sign in to comment.