Skip to content

Commit

Permalink
Stop debugging session when flow is stopped.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphwetzel committed Apr 13, 2024
1 parent 6bcbb35 commit 929d8ae
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions mcu_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,32 @@ module.exports = function(RED) {
// The AbortController for runner_promise
let runner_abort;

RED.events.on("flows:stopping", (...args) => {

let flows = args[0]?.config?.flows;

if (flows && Array.isArray(flows)) {
for (let i=0; i<flows.length; i++) {
let f = flows[i];
if (f?._mcu?.mcu) {
// abort the currently running runner
if (runner_promise && runner_abort) {
runner_abort.abort();
delete runner_promise;
delete runner_abort;
if (proxy) {
proxy.disconnect();
delete proxy;
}
RED.log.info("MCU: Aborting active server side debugging session.");
}
break;
}
}
}

})

function consolidate_mcu_nodes(with_ui_support) {

// Select the nodes to build flows.json
Expand Down

0 comments on commit 929d8ae

Please sign in to comment.