make split node work with out of order messages as long as one of the messages has msg.parts.count set to the proper value

This commit is contained in:
martinb 2020-11-03 09:35:21 +01:00
parent 280203e64e
commit 468cfeffb6
1 changed files with 5 additions and 1 deletions

View File

@ -677,7 +677,10 @@ module.exports = function(RED) {
}
group.msg = Object.assign(group.msg, msg);
var tcnt = group.targetCount;
if (msg.hasOwnProperty("parts")) { tcnt = group.targetCount || msg.parts.count; }
if (msg.hasOwnProperty("parts")) {
tcnt = group.targetCount || msg.parts.count;
group.targetCount = tcnt;
}
if ((tcnt > 0 && group.currentCount >= tcnt) || msg.hasOwnProperty('complete')) {
completeSend(partId);
}
@ -697,3 +700,4 @@ module.exports = function(RED) {
}
RED.nodes.registerType("join",JoinNode);
}