fix(geocoding): bump PROVIDER_TIMEOUT_MS default 5s → 8s

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.
This commit is contained in:
Till JS 2026-04-28 15:39:09 +02:00
parent 15ab24bda8
commit 9a0cf5b676
2 changed files with 6 additions and 2 deletions

View file

@ -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) -------------------------------------------------

View file

@ -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),
},
};
}