diff --git a/packages/node_modules/@node-red/nodes/core/function/10-switch.js b/packages/node_modules/@node-red/nodes/core/function/10-switch.js index fdc345f47..9d68f6b0b 100644 --- a/packages/node_modules/@node-red/nodes/core/function/10-switch.js +++ b/packages/node_modules/@node-red/nodes/core/function/10-switch.js @@ -352,7 +352,9 @@ module.exports = function(RED) { if (msgs.length === 0) { done() } else { - drainMessageGroup(msgs,count,done); + setImmediate(() => { + drainMessageGroup(msgs,count,done); + }) } } }) @@ -505,7 +507,9 @@ module.exports = function(RED) { if (err) { node.error(err,nextMsg); } - processMessageQueue() + setImmediate(() => { + processMessageQueue() + }) }); }