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