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:
parent
df40b779af
commit
8419659e1b
|
@ -57,8 +57,9 @@ class ZKConnection(object):
|
||||||
schema_version = 0
|
schema_version = 0
|
||||||
zkhandler.schema.load(schema_version, quiet=True)
|
zkhandler.schema.load(schema_version, quiet=True)
|
||||||
|
|
||||||
|
try:
|
||||||
ret = function(zkhandler, *args, **kwargs)
|
ret = function(zkhandler, *args, **kwargs)
|
||||||
|
finally:
|
||||||
zkhandler.disconnect()
|
zkhandler.disconnect()
|
||||||
del zkhandler
|
del zkhandler
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue