mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Upgrade SQLAlchemy version and dispose of db engine
This commit is contained in:
1 parent
6af1f2afaa
commit
010d7aa49f
3 files changed
+12
-3
No files matched your search
@@ -51,6 +51,14 @@ async def connect_to_db(app: FastAPI) -> None:
|
||||
log.fatal(f"Error while connecting to database '{db_url}: {e}")
|
||||
|
||||
|
||||
async def disconnect_from_db(app: FastAPI) -> None:
|
||||
|
||||
# dispose of the connection pool used by the database engine
|
||||
if getattr(app.state, "_db_engine"):
|
||||
await app.state._db_engine.dispose()
|
||||
log.info(f"Disconnected from database")
|
||||
|
||||
|
||||
@event.listens_for(Engine, "connect")
|
||||
def set_sqlite_pragma(dbapi_connection, connection_record):
|
||||
|
||||
|
||||
Reference in new issue
Block a user