Skip to content

Commit d0c84cd

Browse files
committed
feat: Update FAISS index with all services on startup
- Add FAISS index update logic in lifespan function after initialization - Iterate through all registered services and call add_or_update_service - Include proper error handling for individual service updates - Track service enabled/disabled state in the index - Add comprehensive logging for the update process Fixes #54
1 parent 0d9371c commit d0c84cd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

registry/main.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ async def lifespan(app: FastAPI):
9292
logger.info("🔍 Initializing FAISS search service...")
9393
await faiss_service.initialize()
9494

95+
logger.info("📊 Updating FAISS index with all registered services...")
96+
all_servers = server_service.get_all_servers()
97+
for service_path, server_info in all_servers.items():
98+
is_enabled = server_service.is_service_enabled(service_path)
99+
try:
100+
await faiss_service.add_or_update_service(service_path, server_info, is_enabled)
101+
logger.debug(f"Updated FAISS index for service: {service_path}")
102+
except Exception as e:
103+
logger.error(f"Failed to update FAISS index for service {service_path}: {e}", exc_info=True)
104+
105+
logger.info(f"✅ FAISS index updated with {len(all_servers)} services")
106+
95107
logger.info("🏥 Initializing health monitoring service...")
96108
await health_service.initialize()
97109

0 commit comments

Comments
 (0)