Ensure zkhandler is always cleaned up

Even if the subfunction of an API @ZKConnection call fails, the
zkhandler needs to terminate and clean up, or it leaves stuck threads
around.
This commit is contained in:
Joshua Boniface 2024-01-30 09:48:17 -05:00
parent df40b779af
commit 8419659e1b
1 changed files with 5 additions and 4 deletions

View File

@ -57,8 +57,9 @@ class ZKConnection(object):
schema_version = 0
zkhandler.schema.load(schema_version, quiet=True)
try:
ret = function(zkhandler, *args, **kwargs)
finally:
zkhandler.disconnect()
del zkhandler