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

ensure trigger doesn't set two simultaneous timeouts

This commit is contained in:
Dave Conway-Jones 2018-02-04 20:17:43 +00:00
parent 22d942b705
commit ff05fb14a6
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4

View File

@ -113,19 +113,21 @@ module.exports = function(RED) {
} }
} }
else { else {
node.topics[topic].tout = setTimeout(function() { if (!node.topics[topic].tout) {
var msg2 = null; node.topics[topic].tout = setTimeout(function() {
if (node.op2type !== "nul") { var msg2 = null;
msg2 = RED.util.cloneMessage(msg); if (node.op2type !== "nul") {
if (node.op2type === "flow" || node.op2type === "global") { msg2 = RED.util.cloneMessage(msg);
node.topics[topic].m2 = RED.util.evaluateNodeProperty(node.op2,node.op2type,node,msg); if (node.op2type === "flow" || node.op2type === "global") {
node.topics[topic].m2 = RED.util.evaluateNodeProperty(node.op2,node.op2type,node,msg);
}
msg2.payload = node.topics[topic].m2;
delete node.topics[topic];
node.send(msg2);
} }
msg2.payload = node.topics[topic].m2; node.status({});
} }, node.duration);
delete node.topics[topic]; }
node.status({});
node.send(msg2);
}, node.duration);
} }
node.status({fill:"blue",shape:"dot",text:" "}); node.status({fill:"blue",shape:"dot",text:" "});
} }