feat: auto-reload grid when background cache refresh completes
Docker / docker (push) Successful in 1m49s

Poll /api/cache-ts every 30s; silently reload concerts if the
cache timestamp increased (background scrape finished).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
dev
2026-05-15 17:03:30 +02:00
parent d3ce89f228
commit 0173681786
2 changed files with 23 additions and 0 deletions
+17
View File
@@ -449,8 +449,25 @@ document.addEventListener('keydown', e => {
}
});
// ── Cache auto-update polling ─────────────────────────────────────────────────
let _cacheTs = 0;
async function pollCacheTs() {
try {
const { ts, count } = await fetch('/api/cache-ts').then(r => r.json());
if (_cacheTs && ts > _cacheTs && count > 0) {
_cacheTs = ts;
await refresh();
} else if (!_cacheTs) {
_cacheTs = ts;
}
} catch {}
}
// ── Init ─────────────────────────────────────────────────────────────────────
(async () => {
await Promise.all([loadCategories(), refreshDlHistory()]);
await refresh();
_cacheTs = (await fetch('/api/cache-ts').then(r => r.json()).catch(() => ({ts:0}))).ts;
setInterval(pollCacheTs, 30_000);
})();