mirror of
https://github.com/rommapp/romm.git
synced 2026-06-30 07:45:52 +00:00
pre ping feature enabled
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import functools
|
||||
|
||||
from fastapi import HTTPException
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.exc import ProgrammingError
|
||||
@@ -13,6 +15,13 @@ class DBHandler:
|
||||
BaseModel.metadata.create_all(engine)
|
||||
self.session = Session()
|
||||
|
||||
|
||||
def retry(func) -> tuple:
|
||||
@functools.wraps(func)
|
||||
def wrapper(*args):
|
||||
return func(*args)
|
||||
return wrapper
|
||||
|
||||
|
||||
def add_platform(self, **kargs) -> None:
|
||||
with Session.begin() as session:
|
||||
|
||||
@@ -7,5 +7,5 @@ from config.config import DB_HOST, DB_PORT, DB_USER, DB_PASSWD, DB_NAME
|
||||
|
||||
BaseModel = declarative_base()
|
||||
|
||||
engine = create_engine(f"mariadb+mariadbconnector://{DB_USER}:{DB_PASSWD}@{DB_HOST}:{DB_PORT}/{DB_NAME}")
|
||||
engine = create_engine(f"mariadb+mariadbconnector://{DB_USER}:{DB_PASSWD}@{DB_HOST}:{DB_PORT}/{DB_NAME}", pool_pre_ping=True)
|
||||
Session = sessionmaker(bind=engine, expire_on_commit=False)
|
||||
Reference in New Issue
Block a user