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:
1 parent
6c63c364bd
commit
96d4d2933c
18 files changed
+299
-32
No files matched your search
@@ -44,7 +44,8 @@ def edges(radio: list[dict], grant_rows: list[dict], chair: str) -> list[dict]:
|
||||
return [{"source": s, "target": t, "class": c, "count": n} for (s, t, c), n in sorted(counts.items())]
|
||||
|
||||
|
||||
def graph(radio: list[dict], grant_rows: list[dict], tasks: dict[str, dict], claims: list[dict], end: float, directory: Directory) -> dict:
|
||||
def graph(radio: list[dict], grant_rows: list[dict], tasks: dict[str, dict], claims: list[dict], span: tuple[float, float], directory: Directory) -> dict:
|
||||
begin, end = span
|
||||
current = {task: row for task, row in sorted(tasks.items()) if status_of(row) not in ENDED}
|
||||
chair = chair_of(claims, directory, end)
|
||||
top = chair or HUMAN
|
||||
@@ -82,7 +83,7 @@ def graph(radio: list[dict], grant_rows: list[dict], tasks: dict[str, dict], cla
|
||||
"parent": parent,
|
||||
"label": label,
|
||||
"names": directory.names(key) or [label],
|
||||
"timeline": directory.timeline(key) or [{"name": label, "since": end}],
|
||||
"timeline": directory.timeline(key, begin) or [{"name": label, "since": end}],
|
||||
"tasks": list(holders.get(key, {}).values()),
|
||||
"claims": [claim for claim in claims if claim["session"] == key],
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user