fix: skip stopped worker live protocol subscriptions

This commit is contained in:
2026-09-18 19:04:52 +09:00
parent ceecbbfe6f
commit cc06b41322
@@ -934,7 +934,7 @@
}
function connectProtocolTransport(
_targetWorker: Worker | null,
targetWorker: Worker | null,
token: number,
target: ConsoleTarget,
) {
@@ -984,6 +984,23 @@
];
return;
}
if (
action.kind === "subscribe_live" &&
targetWorker &&
targetWorker.state === "stopped"
) {
protocolState = "closed";
streamDiagnostics = [
...streamDiagnostics,
{
code: "worker_session_state_changed",
severity: "warning",
message:
"The Session is live but the Worker is stopped. Reload to refresh its state.",
},
];
return;
}
if (action.kind === "subscribe_live") {
closeLiveSubscription = connectLiveProtocolTransport(token, target);
return;