File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,15 +48,15 @@ async def lifespan(app: FastAPI):
4848
4949 # Connect to Neo4j with retries (but don't fail startup)
5050 neo4j_conn = Neo4jConnection ()
51- for attempt in range (3 ):
51+ for attempt in range (10 ): # Increased from 3
5252 try :
5353 await neo4j_conn .connect ()
5454 logger .info ("✅ Connected to Neo4j" )
5555 break
5656 except Exception as e :
5757 logger .warning (f"⚠️ Neo4j connection attempt { attempt + 1 } failed: { e } " )
58- if attempt < 2 :
59- await asyncio .sleep (3 )
58+ if attempt < 9 :
59+ await asyncio .sleep (5 ) # Increased from 3
6060 else :
6161 logger .error ("❌ Failed to connect to Neo4j after 3 attempts - service will start but may not process requests" )
6262 # Don't raise - let service start anyway
@@ -124,6 +124,10 @@ async def process_request(message: dict):
124124 customer_id = message .get ("customer_id" , "anonymous" )
125125
126126 try :
127+ if not retrieval_service :
128+ logger .error ("Retrieval service not initialized - cannot process request" )
129+ raise RuntimeError ("Database connection not available" )
130+
127131 # Retrieve and generate response
128132 result = await retrieval_service .retrieve_and_respond (
129133 query = query ,
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ resource "google_project_service" "run" {
55}
66
77resource "google_project_service" "secretmanager" {
8- service = " secretmanager.googleapis.com"
8+ service = " secretmanager.googleapis.com"
9+ disable_dependent_services = true
910}
1011
1112resource "google_project_service" "artifactregistry" {
You can’t perform that action at this time.
0 commit comments