perf(hub): cache the names directory, share state builds, retry stations

Concurrent /api/state polls share one build through LiveState for a short TTL, and every POST and PATCH invalidates it, so a write is never followed by a stale view. The names directory is cached, the first transcript scan reads outside the hub lock, the graph timeline starts at the window begin, and unresolved radio stations are retried on a daemon thread every RETRY_SECONDS instead of failing until restart.

🎯 Fix: 85 %
💥 Break: 8 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 78
🚦 Gate: ⛔ fix 85 % < 90, break 8 % > 5

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-18 19:54:23 +00:00
1 parent 6c63c364bd
commit 96d4d2933c
18 files changed
+299 -32

No files matched your search

+2 -4
View File
@@ -51,9 +51,7 @@
}
function poll() {
if (!loadsInFlight) {
refresh();
}
refresh();
}
const SELECTION_HOLD = 20000;
@@ -62,7 +60,7 @@
function refresh() {
const selected = String(window.getSelection()).length > 0;
selectedSince = selected ? selectedSince || Date.now() : 0;
if (!ui.busy && !ui.playing && !document.hidden && (!selected || Date.now() - selectedSince >= SELECTION_HOLD)) {
if (!loadsInFlight && !ui.busy && !ui.playing && !document.hidden && (!selected || Date.now() - selectedSince >= SELECTION_HOLD)) {
load();
}
}
+1 -1
View File
@@ -53,7 +53,7 @@
function redirectNote(stream) {
if (stream && stream.via === null) {
return "The server has not resolved this station's redirect yet; saving after ten minutes tries again.";
return "The hub has not resolved this station's redirect yet; it tries again every ten minutes by itself, the hub log names why it failed.";
}
const released = stream ? stream.via : [];
const unloaded = released.filter((origin) => !pageMedia.has(origin));