From 2fb467d2e52401e0d3117752f8c9ac6c9ee25162 Mon Sep 17 00:00:00 2001 From: Nate Emmert Date: Thu, 15 Oct 2026 12:56:31 -0400 Subject: [PATCH] Weather proxy: fall back to the classic request if 15-minute data is rejected Co-Authored-By: Claude Sonnet 5.5 --- app/server.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/server.js b/app/server.js index 2f061d0..35e4a6d 100644 --- a/app/server.js +++ b/app/server.js @@ -714,7 +714,14 @@ app.get('/api/weather', async (req, res) => { precipitation_unit: useMetric ? 'mm' : 'inch' }); - const r = await fetchWithRetry(`https://api.open-meteo.com/v1/forecast?${params}`, { attempts: 3, timeoutMs: 12000, retryDelayMs: 500 }); + let r; + try { + // Single quick attempt with 15-minute rain data; if Open-Meteo rejects it, fall back to the classic request + r = await fetchWithRetry(`https://api.open-meteo.com/v1/forecast?${params}`, { attempts: 1, timeoutMs: 12000 }); + } catch (firstErr) { + params.delete('minutely_15'); params.delete('forecast_minutely_15'); + r = await fetchWithRetry(`https://api.open-meteo.com/v1/forecast?${params}`, { attempts: 3, timeoutMs: 12000, retryDelayMs: 500 }); + } const data = await r.json(); setCache(cacheKey, data); return res.json(data);