Avoid exceeding call stack when draining message group in Switch

Fixes #5013
pull/5014/head
Nick O'Leary 2025-01-13 16:37:35 +00:00
parent 1e8f840993
commit 953b7584a3
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 6 additions and 2 deletions

View File

@ -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()
})
});
}