Files
SnowLuma/packages
DrSmoothl d984833914 perf(webui): share one ref-counted /api/logs/stream across subscribers (#185)
The log viewer and each dashboard "recent alerts" widget opened their own
EventSource to /api/logs/stream, so N alert tiles + the viewer meant N+1
identical connections (plus a short-lived-connection churn on navigation). Make
openLogStream ref-counted: the first subscriber opens a single shared stream,
every frame and status change fans out to all subscribers (each isolated with
try/catch and re-checked against the live Set so a mid-frame unsubscribe is
skipped), and the last to leave closes it. Late subscribers replay the current
status.

Hardening: a no-token open no longer caches a dead disposer (it would have
blocked every later subscriber from ever connecting); the shared URL bakes in the
token, so setToken() tears down and reopens on any token change (re-login would
otherwise retry a stale-token URL forever); the connecting window seeds
'reconnecting' so a late joiner's badge isn't wrongly 'closed'. Consumers are
unchanged — the dedup is transparent behind api.logs.stream.
2026-07-07 22:29:10 +08:00
..
2026-07-06 15:04:55 +08:00
2026-07-06 15:04:55 +08:00
2026-07-06 15:04:55 +08:00
2026-07-06 15:04:55 +08:00
2026-07-06 15:04:55 +08:00
2026-07-06 15:04:55 +08:00
2026-07-06 15:04:55 +08:00
2026-07-06 15:04:55 +08:00