fix(beszel): improve live subscription error handling and cleanup
- Surface subscription errors in useLiveStats via onError + error state - Show error UI in live mode when SSE connection fails - Abort SSE reader on subscribeTopic failure instead of silent log - Guard mock realtime against pre-aborted signal to prevent interval leak - Remove dead includeDocker from subscription input schema
This commit is contained in:
5 files changed
+28
-7
No files matched your search
@@ -283,7 +283,8 @@ export class BeszelIntegration extends Integration {
|
||||
if (!clientId && typeof parsed.clientId === "string") {
|
||||
clientId = parsed.clientId;
|
||||
this.subscribeTopic(clientId, systemId, session.token).catch((err) => {
|
||||
logger.warn("Failed to subscribe to rt_metrics topic", { error: err });
|
||||
logger.warn("Failed to subscribe to rt_metrics topic, aborting SSE", { error: err });
|
||||
reader.cancel().catch(() => {});
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -350,12 +350,13 @@ export class BeszelMockService {
|
||||
};
|
||||
onMessage({ stats: record, containerStats: null });
|
||||
};
|
||||
if (signal.aborted) return;
|
||||
await new Promise<void>((resolve) => {
|
||||
const interval = setInterval(emit, 1000);
|
||||
signal.addEventListener("abort", () => {
|
||||
clearInterval(interval);
|
||||
resolve();
|
||||
});
|
||||
}, { once: true });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user