fix: skip stopped worker live protocol subscriptions
This commit is contained in:
@@ -934,7 +934,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function connectProtocolTransport(
|
function connectProtocolTransport(
|
||||||
_targetWorker: Worker | null,
|
targetWorker: Worker | null,
|
||||||
token: number,
|
token: number,
|
||||||
target: ConsoleTarget,
|
target: ConsoleTarget,
|
||||||
) {
|
) {
|
||||||
@@ -984,6 +984,23 @@
|
|||||||
];
|
];
|
||||||
return;
|
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") {
|
if (action.kind === "subscribe_live") {
|
||||||
closeLiveSubscription = connectLiveProtocolTransport(token, target);
|
closeLiveSubscription = connectLiveProtocolTransport(token, target);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user