fix: refcount StatsCache keys, keep registrations across config change, and tidy GPU/usage render paths

This commit is contained in:
c4ch3c4d3
2026-08-14 13:04:56 -06:00
parent 9e847940d3
commit d52a0596ed
5 changed files with 75 additions and 48 deletions
+2 -5
View File
@@ -12,7 +12,6 @@ class Runtime {
private feed?: EventFeed;
private poller?: MetricsPoller;
private statsCache?: StatsCache;
private statsUnsub?: () => void;
private listeners = new Set<() => void>();
ensureConnections(cfg: LlamaSwapConfig): void {
@@ -22,9 +21,7 @@ class Runtime {
this.poller?.stop();
this.feed = undefined;
this.poller = undefined;
this.statsUnsub?.();
this.statsCache = undefined;
this.statsUnsub = undefined;
this.statsCache?.setConfig(cfg);
this.cfg = cfg;
}
if (!this.feed) {
@@ -46,7 +43,7 @@ class Runtime {
}
if (!this.statsCache) {
this.statsCache = new StatsCache(cfg);
this.statsUnsub = this.statsCache.onChange(() => this.emit());
this.statsCache.onChange(() => this.emit());
}
}