mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-20 21:33:09 +00:00
Merge branch '3.0' into image-md5sum-management
This commit is contained in:
commit
b94f01fe4e
@ -26,6 +26,7 @@ from gns3server.compute.port_manager import PortManager
|
||||
from gns3server.utils.http_client import HTTPClient
|
||||
from gns3server.db.tasks import connect_to_db, get_computes, discover_images_on_filesystem
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -91,4 +92,6 @@ def create_shutdown_handler(app: FastAPI) -> Callable:
|
||||
if PortManager.instance().udp_ports:
|
||||
log.warning(f"UDP ports are still used {PortManager.instance().udp_ports}")
|
||||
|
||||
await disconnect_from_db(app)
|
||||
|
||||
return shutdown_handler
|
||||
|
@ -55,6 +55,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):
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
uvicorn==0.17.6
|
||||
fastapi==0.75.0
|
||||
fastapi==0.75.2
|
||||
python-multipart==0.0.5
|
||||
websockets==10.2
|
||||
aiohttp==3.8.1
|
||||
@ -10,7 +10,7 @@ sentry-sdk==1.5.7
|
||||
psutil==5.9.0
|
||||
distro==1.7.0
|
||||
py-cpuinfo==8.0.0
|
||||
sqlalchemy==1.4.32
|
||||
sqlalchemy==1.4.35
|
||||
aiosqlite===0.17.0
|
||||
passlib[bcrypt]==1.7.4
|
||||
python-jose==3.3.0
|
||||
|
Loading…
Reference in New Issue
Block a user