Fix POI distance calculation reliability for remote/Celery execution

- Fix silent log loss: replace hardcoded "uvicorn.error" logger with __name__
  in osrm_client, otp_client, poi_distance_calculator, and poi_tasks (uvicorn
  logger has no handlers in Celery worker, so all errors were silently dropped)
- Add Celery retry: autoretry_for=(Exception,), max_retries=3, retry_backoff
- Add top-level exception handling in task with full traceback logging
- Fix upsert_distances: replace session.merge() (PK-based) with proper
  dialect-aware INSERT ON DUPLICATE KEY UPDATE / ON CONFLICT DO UPDATE
- Filter out listings with null/zero coordinates before routing
- Raise OSError when all routing engines fail with 0 results computed,
  distinguishing "nothing to compute" from "all engines unreachable"
This commit is contained in:
Viktor Barzin 2026-02-08 20:11:12 +00:00
parent 46995cb9da
commit 5b566bab4c
No known key found for this signature in database
GPG key ID: 0EB088298288D958
5 changed files with 85 additions and 16 deletions

View file

@ -12,7 +12,7 @@ import aiohttp
from config.routing_config import RoutingConfig
from rec.utils import nextMonday
logger = logging.getLogger("uvicorn.error")
logger = logging.getLogger(__name__)
# OTP 2.x GraphQL query for transit plan
_PLAN_QUERY = """