Improved database connection and logging:

Robust ping/reconnect: get_db() now retries ping multiple times and safely recreates the pool once per request.
Healthcheck thread: background daemon periodically pings connections and recreates the pool if needed.
Logging improvements: early pool creation and healthcheck logs appear via proper logger setup.
This commit is contained in:
florian committed 2025-10-12 11:50:13 +02:00
1 parent cd759f43a8
commit 7b0ba7de10
5 files changed
+121 -24

No files matched your search

+2 -2
View File
@@ -4,12 +4,12 @@ from fastapi import HTTPException
from secret_handler import return_credentials
import os
import time
import logging
from logger_handler import setup_logger
backend_api_url=os.getenv("BACKEND_API_URL","localhost:8101/internal/receive-notifications")
api_key= return_credentials("/etc/secrets/api_key")
logger = logging.getLogger(__name__)
logger = setup_logger(__name__)
def send_notification(title:str,