Fix POI distance calculation: OSRM index separator and error handling

- Fix OSRM client to use semicolons (not commas) for source/destination
  indices in /table API requests. Commas caused "Query string malformed"
  errors for any batch with more than one origin.
- Add error handling in poi_distance_calculator for unreachable routing
  engines (OSRM/OTP). Connection failures now log an error and skip the
  mode instead of crashing the entire Celery task.
This commit is contained in:
Viktor Barzin 2026-02-08 14:50:09 +00:00
parent 7084c46f89
commit 8a5d1b3787
No known key found for this signature in database
GPG key ID: 0EB088298288D958
2 changed files with 25 additions and 16 deletions

View file

@ -47,8 +47,8 @@ async def osrm_table(
coords_str = ";".join(f"{lng},{lat}" for lng, lat in all_coords)
# Source/destination indices
source_indices = ",".join(str(i) for i in range(len(origins)))
dest_indices = ",".join(str(i) for i in range(len(origins), len(all_coords)))
source_indices = ";".join(str(i) for i in range(len(origins)))
dest_indices = ";".join(str(i) for i in range(len(origins), len(all_coords)))
url = (
f"{base_url}/table/v1/{profile}/{coords_str}"