24h forecasting

This commit is contained in:
2026-06-24 13:33:08 -04:00
parent 9a9fde7caa
commit 5f71bd182a

View File

@@ -181,15 +181,19 @@ app.get('*', (req, res) => {
// ── Start ───────────────────────────────────────────────────────────────────── // ── Start ─────────────────────────────────────────────────────────────────────
async function startForecast() {
let ready = false let ready = false
while (!ready) { while (!ready) {
try { try {
await refreshForecast() await refreshForecast()
ready = lastForecast.slots.length > 0 ready = cache.slots.length > 0
} catch {} } catch {}
if (!ready) await new Promise(r => setTimeout(r, 5000)) if (!ready) await new Promise(r => setTimeout(r, 5000))
} }
setInterval(refreshForecast, 10 * 60 * 1000) setInterval(refreshForecast, 10 * 60 * 1000)
}
startForecast()
const c = cfg(); const c = cfg();
app.listen(c.PORT, () => { app.listen(c.PORT, () => {