auto-sync: 2026-05-06 19:00:01

This commit is contained in:
Stream
2026-05-06 19:00:01 +03:00
parent 1e8811a5d2
commit 8ba1860170

View File

@@ -913,7 +913,7 @@ async def _build_segmented_route(req: RouteRequest) -> dict:
except Exception as e:
raise HTTPException(503, f"OSRM недоступен: {e}")
# Retry TooBig → 3 → 1
# Retry TooBig → 3 → 2 → 1
if data.get("code") == "TooBig":
url2 = url.replace("alternatives=5", "alternatives=3")
try:
@@ -922,6 +922,14 @@ async def _build_segmented_route(req: RouteRequest) -> dict:
data = resp.json()
except Exception as e:
raise HTTPException(503, f"OSRM недоступен: {e}")
if data.get("code") == "TooBig":
url2b = url.replace("alternatives=5", "alternatives=2")
try:
async with httpx.AsyncClient(timeout=60) as client:
resp = await client.get(url2b)
data = resp.json()
except Exception as e:
raise HTTPException(503, f"OSRM недоступен: {e}")
if data.get("code") == "TooBig":
url1 = url.replace("alternatives=5", "alternatives=false")
try: