From 5172ec5d66bc4a9e31c08437c2ce4ca2ad176431 Mon Sep 17 00:00:00 2001 From: "mula.liu" Date: Wed, 3 Dec 2025 18:31:27 +0800 Subject: [PATCH] feat: Refactor HorizonsService to use httpx and system_settings for timeout control --- backend/app/services/horizons.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/app/services/horizons.py b/backend/app/services/horizons.py index 1ffc77d..6099925 100644 --- a/backend/app/services/horizons.py +++ b/backend/app/services/horizons.py @@ -415,7 +415,7 @@ class HorizonsService: return positions - async def search_body_by_name(self, name: str) -> dict: + async def search_body_by_name(self, name: str, db: AsyncSession) -> dict: """ Search for a celestial body by name in NASA Horizons database using httpx. This method replaces the astroquery-based search to unify proxy and timeout control. @@ -435,7 +435,8 @@ class HorizonsService: "CENTER": "@ssb" # Search from Solar System Barycenter for consistent object IDs } - client_kwargs = {"timeout": settings.nasa_api_timeout} + timeout = await self._get_timeout(db) + client_kwargs = {"timeout": timeout} if settings.proxy_dict: client_kwargs["proxies"] = settings.proxy_dict