Live updates: one poller per tab instead of SSE streams

Every useLive() call opened its own EventSource, and the library page and a
model's Jobs tab call it twice. Over plain HTTP a browser allows 6 connections
per host, so with three library tabs open the third took ~10 s to load and its
requests never got an answer; a fourth tab didn't load.

- /api/live answers one short request with the job snapshot (left out when the
  client already has that version) and, for job pages, new log lines.
- src/lib/live-store.ts runs one poller per query per tab, shared by every
  component showing it, paused while the tab is hidden, with backoff on errors.
  One router.refresh() per finished job instead of one per component.
- The worker dot reads the status from that poll; it only asks /api/status
  (every 10 s) when nothing else is polled.
- The worker status no longer carries the heartbeat time (it changed every 5 s,
  so every idle stream re-sent its snapshot) and rounds free space to MiB.
- Removes /api/stream: its sleep() added an abort listener per second to the
  request signal and never removed it.
- Job actions poll right away after starting or cancelling a job; drops
  approveJob/rejectJob, whose routes went away in 0.15.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EooZ9biu7kFNB4eDJrwQc5
This commit is contained in:
Claude committed 2026-11-01 20:46:54 +00:00
1 parent 16c3fcc113
commit 76d851896e
11 files changed
+623 -185

No files matched your search

+10
View File
@@ -4,6 +4,16 @@ All notable changes to this project are documented here.
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); each milestone of
step 1 (Hugging Face downloader) is released as a minor version.
## [Unreleased]
### Fixed
- **Several open tabs no longer stall Kaname.** Every tab with live progress kept one or two
connections open, and over plain HTTP a browser allows six per server: the third tab loaded
slowly and a fourth not at all. Live updates are now short requests, one poller per tab shared by
everything on the page, paused while the tab is in the background. The server also no longer
grows in memory while a tab stays open, and an idle page no longer redraws every 5 seconds.
## [0.16.0] - 2026-10-30
A new look, a search for everything (⌘K / Ctrl+K), removing single files, and an easier deployment