mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
fix join node in array mode with repeated messages, and rallow reset all
to close #2866
This commit is contained in:
@@ -259,7 +259,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
} else { // otherwise drop the message.
|
||||
done();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -561,7 +561,7 @@ module.exports = function(RED) {
|
||||
reduceMessage(node, nextMsgInfo, err => {
|
||||
if (err) {
|
||||
nextMsgInfo.done(err);//.error(err,nextMsg);
|
||||
}
|
||||
}
|
||||
activeMessage = null;
|
||||
processReduceMessageQueue();
|
||||
})
|
||||
@@ -570,12 +570,7 @@ module.exports = function(RED) {
|
||||
this.on("input", function(msg, send, done) {
|
||||
try {
|
||||
var property;
|
||||
if (node.mode === 'auto' && (!msg.hasOwnProperty("parts")||!msg.parts.hasOwnProperty("id"))) {
|
||||
node.warn("Message missing msg.parts property - cannot join in 'auto' mode")
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
var partId = "_";
|
||||
if (node.propertyType == "full") {
|
||||
property = msg;
|
||||
}
|
||||
@@ -589,7 +584,21 @@ module.exports = function(RED) {
|
||||
}
|
||||
}
|
||||
|
||||
var partId;
|
||||
if (node.mode === 'auto' && (!msg.hasOwnProperty("parts")||!msg.parts.hasOwnProperty("id"))) {
|
||||
// if a blank reset messag erest it all.
|
||||
if (msg.hasOwnProperty("reset")) {
|
||||
if (inflight && inflight.hasOwnProperty("partId") && inflight[partId].timeout) {
|
||||
clearTimeout(inflight[partId].timeout);
|
||||
}
|
||||
inflight = {};
|
||||
}
|
||||
else {
|
||||
node.warn("Message missing msg.parts property - cannot join in 'auto' mode")
|
||||
}
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
var payloadType;
|
||||
var propertyKey;
|
||||
var targetCount;
|
||||
@@ -611,7 +620,6 @@ module.exports = function(RED) {
|
||||
}
|
||||
else {
|
||||
// Use the node configuration to identify all of the group information
|
||||
partId = "_";
|
||||
payloadType = node.build;
|
||||
targetCount = node.count;
|
||||
joinChar = node.joiner;
|
||||
@@ -621,6 +629,9 @@ module.exports = function(RED) {
|
||||
if (node.build === 'object') {
|
||||
propertyKey = RED.util.getMessageProperty(msg,node.key);
|
||||
}
|
||||
if (msg.hasOwnProperty("parts")) {
|
||||
propertyIndex = msg.parts.index;
|
||||
}
|
||||
}
|
||||
|
||||
if (msg.hasOwnProperty("reset")) {
|
||||
@@ -725,8 +736,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
} else {
|
||||
if (!isNaN(propertyIndex)) {
|
||||
if (group.payload[propertyIndex] == undefined) { group.currentCount++; }
|
||||
group.payload[propertyIndex] = property;
|
||||
group.currentCount++;
|
||||
} else {
|
||||
if (property !== undefined) {
|
||||
group.payload.push(property);
|
||||
@@ -762,4 +773,3 @@ module.exports = function(RED) {
|
||||
}
|
||||
RED.nodes.registerType("join",JoinNode);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user