Check if session in transaction before closing
JIRA:NCP-1715 According to the docs this is maybe 'okay' but there is a better way using listeners and etc. See: http://tinyurl.com/qyae778
This commit is contained in:
@@ -111,10 +111,11 @@ qres_reg.ResourceRegistry.get_instance().register_resources(quark_resources)
|
|||||||
def sessioned(func):
|
def sessioned(func):
|
||||||
def _wrapped(self, context, *args, **kwargs):
|
def _wrapped(self, context, *args, **kwargs):
|
||||||
res = func(self, context, *args, **kwargs)
|
res = func(self, context, *args, **kwargs)
|
||||||
context.session.close()
|
if not context.session.is_active:
|
||||||
# NOTE(mdietz): Forces neutron to get a fresh session
|
context.session.close()
|
||||||
# if it needs it after our call
|
# NOTE(mdietz): Forces neutron to get a fresh session
|
||||||
context._session = None
|
# if it needs it after our call
|
||||||
|
context._session = None
|
||||||
return res
|
return res
|
||||||
return _wrapped
|
return _wrapped
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user