From 9a0cf5b6765a9cc87fa745d5f2303a8029f2e514 Mon Sep 17 00:00:00 2001 From: Till JS Date: Tue, 28 Apr 2026 15:39:09 +0200 Subject: [PATCH] =?UTF-8?q?fix(geocoding):=20bump=20PROVIDER=5FTIMEOUT=5FM?= =?UTF-8?q?S=20default=205s=20=E2=86=92=208s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First-probe DNS+TLS handshake against Nominatim can take >5s on a cold start (verified locally: 642ms warm, sometimes 5-8s cold). The old 5s default false-marked Nominatim unhealthy and the 30s health- cache then locked us into a fallback-of-fallback gap. 8s gives enough headroom for cold-start while still cutting off actually- stuck connections. Photon and Pelias don't hit this — Photon's CDN is consistently sub-second and Pelias is on localhost / LAN. Only the public Nominatim path warranted the bump, but the timeout is per-provider shared so we adjust it globally. Existing PROVIDER_TIMEOUT_MS env override still wins. --- services/mana-geocoding/CLAUDE.md | 2 +- services/mana-geocoding/src/config.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/services/mana-geocoding/CLAUDE.md b/services/mana-geocoding/CLAUDE.md index cfdde7217..c3831fd96 100644 --- a/services/mana-geocoding/CLAUDE.md +++ b/services/mana-geocoding/CLAUDE.md @@ -154,7 +154,7 @@ PORT=3018 # --- Provider chain (tried in order) ---------------------------------- GEOCODING_PROVIDERS=pelias,photon,nominatim -PROVIDER_TIMEOUT_MS=5000 # per-provider request timeout +PROVIDER_TIMEOUT_MS=8000 # per-provider request timeout (cold-start safe) PROVIDER_HEALTH_CACHE_MS=30000 # health-cache TTL — skip dead providers # --- Pelias (primary) ------------------------------------------------- diff --git a/services/mana-geocoding/src/config.ts b/services/mana-geocoding/src/config.ts index 04bb88bd7..96f2c8888 100644 --- a/services/mana-geocoding/src/config.ts +++ b/services/mana-geocoding/src/config.ts @@ -72,7 +72,11 @@ export function loadConfig(): Config { 'nominatim', ]), healthCacheMs: parseInt(process.env.PROVIDER_HEALTH_CACHE_MS || '30000', 10), - timeoutMs: parseInt(process.env.PROVIDER_TIMEOUT_MS || '5000', 10), + // 8 s default. Nominatim's cold-start DNS+TLS handshake can push the + // first health probe past the older 5 s default, false-marking the + // provider unhealthy for the next 30 s. 8 s survives a slow first + // probe but still cuts off actually-stuck connections. + timeoutMs: parseInt(process.env.PROVIDER_TIMEOUT_MS || '8000', 10), }, }; }