From 72b8dbb45b8c2699b2b7e83f58ea49946348ebf0 Mon Sep 17 00:00:00 2001
From: Dave Conway-Jones
A timeout can be set to trigger sending the new message using whatever has been received so far.
-If a message is received with the msg.complete property set, the output message is sent.
+If a message is received with the msg.complete property set, the output message is finalised and sent. + This resets any part counts.
When configured to join in reduce mode, an expression is applied to each diff --git a/nodes/core/logic/17-split.js b/nodes/core/logic/17-split.js index 3170ba584..f5ad199ca 100644 --- a/nodes/core/logic/17-split.js +++ b/nodes/core/logic/17-split.js @@ -586,7 +586,10 @@ module.exports = function(RED) { } else { if (msg.hasOwnProperty('complete')) { - completeSend(partId); + if (inflight[partId]) { + inflight[partId].msg.complete = msg.complete; + completeSend(partId); + } } else { node.warn("Message missing key property 'msg."+node.key+"' - cannot add to object") @@ -594,6 +597,7 @@ module.exports = function(RED) { } return; } + if (!inflight.hasOwnProperty(partId)) { if (payloadType === 'object' || payloadType === 'merged') { inflight[partId] = { @@ -604,19 +608,6 @@ module.exports = function(RED) { msg:RED.util.cloneMessage(msg) }; } - else if (node.accumulate === true) { - if (msg.hasOwnProperty("reset")) { delete inflight[partId]; } - inflight[partId] = inflight[partId] || { - currentCount:0, - payload:{}, - targetCount:targetCount, - type:payloadType, - msg:RED.util.cloneMessage(msg) - } - if (payloadType === 'string' || payloadType === 'array' || payloadType === 'buffer') { - inflight[partId].payload = []; - } - } else { inflight[partId] = { currentCount:0,