Improved database connection and logging
This commit is contained in:
1 parent
519e13f045
commit
c89804b7b3
5 files changed
+114
-21
No files matched your search
+4
-1
@@ -4,7 +4,7 @@ from github_api import find_package_version_with_tag as find_package_version_wit
|
||||
from dockerhub_api import find_package_version_with_tag as find_package_version_with_tag_dockerhub
|
||||
import uvicorn
|
||||
from contextlib import asynccontextmanager
|
||||
from db import get_db, create_connection_pool, close_connection_pool
|
||||
from db import get_db, create_connection_pool, close_connection_pool, start_healthcheck_thread
|
||||
import logging
|
||||
from send_notification import send_notification
|
||||
from metrics_server import REQUEST_COUNTER
|
||||
@@ -19,6 +19,9 @@ async def lifespan(app: FastAPI):
|
||||
logger.info("Creating MySQL connection pool...")
|
||||
create_connection_pool()
|
||||
|
||||
start_healthcheck_thread()
|
||||
logger.info("MySQL healthcheck thread started.")
|
||||
|
||||
yield
|
||||
logger.info("Closing MySQL connection pool...")
|
||||
close_connection_pool()
|
||||
|
||||
Reference in new issue
Block a user