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

+4 -1
View File
@@ -77,9 +77,10 @@ from kvb_orchestrator.engines import Engines
from kvb_orchestrator.errors import ToolError
from kvb_orchestrator.exchange import HubServer
from kvb_orchestrator.handler import Handler
from kvb_orchestrator.hub import Places, open_hub, sighting
from kvb_orchestrator.hub import Places, open_hub, sighting, stations
from kvb_orchestrator.keys import key_from
from kvb_orchestrator.language import Model
from kvb_orchestrator.livestate import LIVE_TTL
from kvb_orchestrator.redirects import TIMEOUT, Redirects, dial
from kvb_orchestrator.skill_scripts import Scripts
from kvb_orchestrator.speechservice import Service
@@ -119,12 +120,14 @@ def main() -> int:
),
approvers=args.approvers,
redirects=Redirects(tls=ssl.create_default_context(), dial=dial, timeout=TIMEOUT),
live_ttl=LIVE_TTL,
)
except ToolError as error:
parser.error(str(error))
server = HubServer((args.bind, args.listen_port), Handler)
server.hub = hub
sighting(hub, threading.Event())
stations(hub, threading.Event())
print(f"{NAME}: listening on {args.bind}:{args.listen_port}, public port {args.public_port}", flush=True)
server.serve_forever()
return 0