mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 23:41:17 -05:00
nested session issue encountered in sqlalchemy 2.0 upgrade
This commit is contained in:
@@ -12,7 +12,7 @@ def autocommit(func):
|
|||||||
try:
|
try:
|
||||||
res = func(*args, **kwargs)
|
res = func(*args, **kwargs)
|
||||||
|
|
||||||
if not db.session.is_active:
|
if not db.session().in_nested_transaction():
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
return res
|
return res
|
||||||
@@ -30,7 +30,7 @@ def transaction():
|
|||||||
yield
|
yield
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
if not db.session.is_active:
|
if not db.session().in_nested_transaction():
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
except Exception:
|
except Exception:
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
|
|||||||
Reference in New Issue
Block a user