Add trace for who last started the stack

This commit is contained in:
Nick O'Leary
2024-03-21 20:48:35 +00:00
parent bd57bce2d3
commit 884bbe01f0

View File

@@ -44,9 +44,11 @@ var activeNodesToFlow = {};
var typeEventRegistered = false; var typeEventRegistered = false;
let lastStarterStack
function init(runtime) { function init(runtime) {
if (started) { if (started) {
throw new Error("Cannot init without a stop"); throw new Error("Cannot init without a stop:" + lastStarterStack);
} }
settings = runtime.settings; settings = runtime.settings;
storage = runtime.storage; storage = runtime.storage;
@@ -274,7 +276,7 @@ async function start(type,diff,muteLog,isDeploy) {
if (diff && diff.globalConfigChanged) { if (diff && diff.globalConfigChanged) {
type = 'full' type = 'full'
} }
lastStarterStack = new Error('Flows started here').stack
started = true; started = true;
state = 'start' state = 'start'
var i; var i;
@@ -334,6 +336,7 @@ async function start(type,diff,muteLog,isDeploy) {
log.info(log._("nodes.flows.stopped-flows")); log.info(log._("nodes.flows.stopped-flows"));
events.emit("runtime-event",{id:"runtime-state",payload:{ state: 'stop', deploy:isDeploy },retain:true}); events.emit("runtime-event",{id:"runtime-state",payload:{ state: 'stop', deploy:isDeploy },retain:true});
state = 'stop' state = 'stop'
lastStarterStack = null
started = false started = false
return return
} }
@@ -454,6 +457,7 @@ function stop(type,diff,muteLog,isDeploy) {
if (diff.globalConfigChanged) { if (diff.globalConfigChanged) {
type = 'full' type = 'full'
} }
lastStarterStack = null
started = false; started = false;
state = 'stop' state = 'stop'
var promises = []; var promises = [];