Tidy up code removal

This commit is contained in:
Nick O'Leary 2024-12-06 16:21:19 +00:00
parent b7306f7fa1
commit 53d9e3a542
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -291,27 +291,23 @@ module.exports = function(RED) {
}
}
else if (!msg.hasOwnProperty("reset")) {
if (maxKeptMsgsCount(node) > 0 && !node.drop) {
if (node.allowrate && msg.hasOwnProperty("rate") && !isNaN(parseFloat(msg.rate))) {
node.rate = msg.rate;
}
else {
if (node.allowrate && msg.hasOwnProperty("rate") && !isNaN(parseFloat(msg.rate))) {
node.rate = msg.rate;
}
var timeSinceLast;
if (node.lastSent) {
timeSinceLast = process.hrtime(node.lastSent);
}
if (!node.lastSent) { // ensuring that we always send the first message
node.lastSent = process.hrtime();
send(msg);
}
else if ( ( (timeSinceLast[0] * SECONDS_TO_NANOS) + timeSinceLast[1] ) > (node.rate * MILLIS_TO_NANOS) ) {
node.lastSent = process.hrtime();
send(msg);
}
else if (node.outputs === 2) {
send([null,msg])
}
var timeSinceLast;
if (node.lastSent) {
timeSinceLast = process.hrtime(node.lastSent);
}
if (!node.lastSent) { // ensuring that we always send the first message
node.lastSent = process.hrtime();
send(msg);
}
else if ( ( (timeSinceLast[0] * SECONDS_TO_NANOS) + timeSinceLast[1] ) > (node.rate * MILLIS_TO_NANOS) ) {
node.lastSent = process.hrtime();
send(msg);
}
else if (node.outputs === 2) {
send([null,msg])
}
done();
}