fix: skip stopped worker live protocol subscriptions
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user