@@ -22,23 +22,12 @@ async def lifespan(app: FastAPI):
2222 setup_logging ()
2323 logger = get_logger ("app" , component = "application" )
2424
25- # Initialize database pool with retry and timeout
25+ # Initialize database pool
2626 from db .pool import database_pool
27- import asyncio
28-
29- try :
30- # Try to connect to database with timeout
31- await asyncio .wait_for (
32- database_pool .setup (logger = logger ),
33- timeout = 10.0 , # 10 second timeout for database connection
34- )
35- logger .info ("Database connection established successfully" )
36- except asyncio .TimeoutError :
37- logger .warning ("Database connection timed out during startup - continuing without database" )
38- except Exception as e :
39- logger .warning (f"Database connection failed during startup: { e } - continuing without database" )
40-
41- # Ensure temporary directory exists
27+
28+ await database_pool .setup (logger = logger )
29+
30+ # Create tmp directories
4231 from core .config import settings
4332
4433 settings .tmp_dir .mkdir (parents = True , exist_ok = True )
@@ -55,10 +44,7 @@ async def lifespan(app: FastAPI):
5544 yield
5645
5746 # Shutdown
58- try :
59- await database_pool .close ()
60- except Exception as e :
61- logger .warning (f"Error closing database pool: { e } " )
47+ await database_pool .close ()
6248 logger .info ("App shutdown complete" )
6349
6450
0 commit comments