Skip to content

Commit 312b7a6

Browse files
committed
Final Fixing | Time to rest
1 parent a8b323c commit 312b7a6

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

services/agents/chat/main.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff 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,

terraform/apis.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ resource "google_project_service" "run" {
55
}
66

77
resource "google_project_service" "secretmanager" {
8-
service = "secretmanager.googleapis.com"
8+
service = "secretmanager.googleapis.com"
9+
disable_dependent_services = true
910
}
1011

1112
resource "google_project_service" "artifactregistry" {

0 commit comments

Comments
 (0)