24h forecasting
This commit is contained in:
@@ -181,15 +181,19 @@ app.get('*', (req, res) => {
|
|||||||
|
|
||||||
// ── Start ─────────────────────────────────────────────────────────────────────
|
// ── Start ─────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
let ready = false
|
async function startForecast() {
|
||||||
while (!ready) {
|
let ready = false
|
||||||
try {
|
while (!ready) {
|
||||||
await refreshForecast()
|
try {
|
||||||
ready = lastForecast.slots.length > 0
|
await refreshForecast()
|
||||||
} catch {}
|
ready = cache.slots.length > 0
|
||||||
if (!ready) await new Promise(r => setTimeout(r, 5000))
|
} catch {}
|
||||||
|
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, () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user