This commit is contained in:
jxxghp 2023-10-18 20:46:58 +08:00
parent 897369d300
commit dad5d76664

View File

@ -1,9 +1,8 @@
import threading
from typing import Any, Self, List from typing import Any, Self, List
from sqlalchemy.orm import as_declarative, declared_attr, Session from sqlalchemy.orm import as_declarative, declared_attr, Session
from app.db import ScopedSession, DBLock from app.db import DBLock
def db_persist(func): def db_persist(func):
@ -20,9 +19,6 @@ def db_persist(func):
db = arg db = arg
break break
try: try:
if db:
db.close()
db = ScopedSession()
result = func(*args, **kwargs) result = func(*args, **kwargs)
db.commit() db.commit()
except Exception as err: except Exception as err: