ping - clone msg in order to fix handling arrays of multiple requests.

This commit is contained in:
Dave Conway-Jones 2022-10-02 10:33:25 +01:00
parent c8975019ad
commit 5aa99eca73
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
2 changed files with 3 additions and 3 deletions

View File

@ -235,12 +235,12 @@ module.exports = function(RED) {
let pingables = generatePingList(payload) let pingables = generatePingList(payload)
for (let index = 0; index < pingables.length; index++) { for (let index = 0; index < pingables.length; index++) {
const element = pingables[index]; const element = pingables[index];
if (element) { doPing(node, element, msg, false); } if (element) { doPing(node, element, RED.util.cloneMessage(msg), false); }
} }
} else if (Array.isArray(payload) ) { } else if (Array.isArray(payload) ) {
for (let index = 0; index < payload.length; index++) { for (let index = 0; index < payload.length; index++) {
const element = payload[index]; const element = payload[index];
if (element) { doPing(node, element, msg, true); } if (element) { doPing(node, element, RED.util.cloneMessage(msg), true); }
} }
} }
}); });

View File

@ -1,6 +1,6 @@
{ {
"name" : "node-red-node-ping", "name" : "node-red-node-ping",
"version" : "0.3.2", "version" : "0.3.3",
"description" : "A Node-RED node to ping a remote server, for use as a keep-alive check.", "description" : "A Node-RED node to ping a remote server, for use as a keep-alive check.",
"dependencies" : { "dependencies" : {
}, },