mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
client support for rpc cancel (#249)
This commit is contained in:
@@ -51,7 +51,11 @@ async function* rpcResponseGenerator(
|
||||
return;
|
||||
}
|
||||
const shouldTerminate = yield msg.data;
|
||||
if (shouldTerminate || !msg.cont) {
|
||||
if (shouldTerminate) {
|
||||
sendRpcCancel(reqid);
|
||||
return;
|
||||
}
|
||||
if (!msg.cont) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -65,6 +69,12 @@ async function* rpcResponseGenerator(
|
||||
}
|
||||
}
|
||||
|
||||
function sendRpcCancel(reqid: string) {
|
||||
const rpcMsg: RpcMessage = { reqid: reqid, cancel: true };
|
||||
const wsMsg: WSRpcCommand = { wscommand: "rpc", message: rpcMsg };
|
||||
globalWS.pushMessage(wsMsg);
|
||||
}
|
||||
|
||||
function sendRpcCommand(msg: RpcMessage): AsyncGenerator<RpcMessage, void, boolean> {
|
||||
const wsMsg: WSRpcCommand = { wscommand: "rpc", message: msg };
|
||||
globalWS.pushMessage(wsMsg);
|
||||
|
||||
Reference in New Issue
Block a user