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