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