1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Use a properly random is for parts.id

to close #1583
This commit is contained in:
Dave Conway-Jones 2018-01-28 21:15:59 +00:00
parent 50956c51f7
commit 1d4a435f20
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4

View File

@ -71,7 +71,8 @@ module.exports = function(RED) {
if (msg.hasOwnProperty("payload")) {
if (msg.hasOwnProperty("parts")) { msg.parts = { parts:msg.parts }; } // push existing parts to a stack
else { msg.parts = {}; }
msg.parts.id = msg._msgid; // use the existing _msgid by default.
msg.parts.id = RED.util.generateId(); // generate a random id
delete msg._msgid;
if (typeof msg.payload === "string") { // Split String into array
msg.payload = (node.remainder || "") + msg.payload;
msg.parts.type = "string";
@ -628,7 +629,7 @@ module.exports = function(RED) {
group.msg = msg;
var tcnt = group.targetCount;
if (msg.hasOwnProperty("parts")) { tcnt = group.targetCount || msg.parts.count; }
if ((tcnt > 0 && group.currentCount >= tcnt) || msg.hasOwnProperty('complete')) {
if ((tcnt > 0 && group.currentCount >= tcnt) || msg.hasOwnProperty('complete')) {
completeSend(partId);
}
} catch(err) {