Nanny7 commited on
Commit
49c7ffd
·
1 Parent(s): d5162a6

Fix: Defer database connection to allow container startup

Browse files
Files changed (1) hide show
  1. src/main.py +5 -7
src/main.py CHANGED
@@ -23,14 +23,12 @@ async def lifespan(app: FastAPI):
23
  Manage application lifespan events.
24
 
25
  Handles database connection on startup and graceful shutdown.
 
26
  """
27
- # Startup: Initialize database connection
28
- try:
29
- await init_db()
30
- print("[OK] Database connection initialized")
31
- except Exception as e:
32
- print(f"[ERROR] Database initialization failed: {e}")
33
- raise
34
 
35
  yield
36
 
 
23
  Manage application lifespan events.
24
 
25
  Handles database connection on startup and graceful shutdown.
26
+ Database connection is deferred to first actual use.
27
  """
28
+ # Startup: Skip database initialization to allow container to start
29
+ # Database will connect on first request
30
+ print("[INFO] Starting application (database connection deferred)")
31
+ print("[INFO] Database will connect on first API request")
 
 
 
32
 
33
  yield
34