mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Don't send message if it doesn't exist. and give it time not to exist.
to close #1527
This commit is contained in:
parent
fc6748a46b
commit
f737ea96f3
@ -127,16 +127,18 @@ module.exports = function(RED) {
|
||||
node.status({fill:"blue",shape:"dot",text:" "});
|
||||
}
|
||||
else if ((node.extend === "true" || node.extend === true) && (node.duration > 0)) {
|
||||
if (node.topics[topic].tout) { clearTimeout(node.topics[topic].tout); }
|
||||
if (node.op2type === "payl") { node.topics[topic].m2 = RED.util.cloneMessage(msg.payload); }
|
||||
if (node.topics[topic].tout) { clearTimeout(node.topics[topic].tout); }
|
||||
node.topics[topic].tout = setTimeout(function() {
|
||||
if (node.op2type !== "nul") {
|
||||
var msg2 = RED.util.cloneMessage(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;
|
||||
node.send(msg2);
|
||||
if (node.topics[topic] !== undefined) {
|
||||
msg2.payload = node.topics[topic].m2;
|
||||
node.send(msg2);
|
||||
}
|
||||
}
|
||||
delete node.topics[topic];
|
||||
node.status({});
|
||||
|
@ -282,7 +282,7 @@ describe('trigger node', function() {
|
||||
n1.emit("input", {payload:1,topic:"A"});
|
||||
n1.emit("input", {payload:2,topic:"B"});
|
||||
n1.emit("input", {payload:3,topic:"C"});
|
||||
setTimeout( function() { n1.emit("input", {payload:2,topic:"B"})}, 25 );
|
||||
setTimeout( function() { n1.emit("input", {payload:2,topic:"B"})}, 20 );
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user