fix(webui): dropped-frame reconcile + split systemInfo cadence + diff-loop unref
Three findings from the adversarial review, all in the WebUI integration:
D: SSE {kind:'dropped'} now triggers a one-shot REST refresh of
qq-list/processes/connections instead of being silently ignored.
Reasoning: when createFramePusher drops frames under backpressure, the
NEXT delivered frame is per-resource (only the resource whose debounce
timer next fires) — NOT a refresh of all 3. If the dropped frame was
the only update for a slow-changing resource (e.g. connections stable
afterwards), the WebUI stays stale until the 30s reconcile. The
refresh is fire-and-forget; each refresh helper already swallows errors.
E: systemInfo gets its own fast useEffect on the user's pollInterval
(default 3s). The earlier commit slowed it to 30s claiming the data was
'daily cadence', but SystemInfo carries live values (uptime,
cpu.loadAvg, memory.usagePercent, runtime.heapUsed) that the overview
widget animates — 30s is a visible regression. The other 3 resources
stay on the 30s SSE-reconcile fallback.
F: connection-diff-loop's setInterval is now .unref()'d (mirrors the
tokenJanitor pattern at server.ts:462). The discarded handle is now
commented as intentional — initWebUI has no shutdown path, so the
handle has no consumer; unref is the right cleanup primitive.
WebUI typecheck clean. 437/437 core suite (no behavior change in core
tests — only the diff-loop file's timer.unref?.() call is new and is
optional-chained so vitest's fake timers don't crash).
This commit is contained in:
3 files changed
+53
-17
No files matched your search
@@ -74,6 +74,11 @@ export function startConnectionDiffLoop(opts: ConnectionDiffLoopOptions): Connec
|
||||
};
|
||||
|
||||
const timer = setInterval(tick, intervalMs);
|
||||
// Don't pin the Node event loop: the loop is permanent for the server
|
||||
// lifetime by design, but tests / a future hot-reload scenario must be
|
||||
// able to exit cleanly without an outstanding interval ref. Mirrors the
|
||||
// tokenJanitor pattern in server.ts.
|
||||
timer.unref?.();
|
||||
|
||||
return {
|
||||
dispose(): void {
|
||||
|
||||
Reference in new issue
Block a user