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

Delay node only warn once on queue >1000 messages

and then again at >10000 messages
This commit is contained in:
Dave Conway-Jones 2016-06-10 23:21:12 +01:00
parent d82fe95076
commit 1cfad27d6f
2 changed files with 11 additions and 5 deletions

View File

@ -101,6 +101,7 @@ module.exports = function(RED) {
}); });
} else if (node.pauseType === "rate") { } else if (node.pauseType === "rate") {
var olddepth = 0;
node.on("input", function(msg) { node.on("input", function(msg) {
if (!node.drop) { if (!node.drop) {
if ( node.intervalID !== -1) { if ( node.intervalID !== -1) {
@ -108,9 +109,14 @@ module.exports = function(RED) {
if (node.buffer.length > 0) { if (node.buffer.length > 0) {
node.status({text:node.buffer.length}); node.status({text:node.buffer.length});
} }
if (node.buffer.length > 1000) { if ((node.buffer.length > 1000) && (olddepth < 1000)) {
olddepth = 1000;
node.warn(node.name + " " + RED._("delay.error.buffer")); node.warn(node.name + " " + RED._("delay.error.buffer"));
} }
if ((node.buffer.length > 10000) && (olddepth < 10000)) {
olddepth = 10000;
node.warn(node.name + " " + RED._("delay.error.buffer1"));
}
} else { } else {
node.send(msg); node.send(msg);
node.intervalID = setInterval(function() { node.intervalID = setInterval(function() {
@ -119,9 +125,9 @@ module.exports = function(RED) {
node.intervalID = -1; node.intervalID = -1;
node.status({}); node.status({});
} }
if (node.buffer.length > 0) { if (node.buffer.length > 0) {
node.send(node.buffer.shift()); node.send(node.buffer.shift());
if (node.buffer.length < 1000) { olddepth = 0; }
node.status({text:node.buffer.length}); node.status({text:node.buffer.length});
} }
},node.rate); },node.rate);
@ -190,14 +196,13 @@ module.exports = function(RED) {
}, wait); }, wait);
node.idList.push(id); node.idList.push(id);
}); });
node.on("close", function() { node.on("close", function() {
for (var i=0; i<node.idList.length; i++ ) { for (var i=0; i<node.idList.length; i++ ) {
clearTimeout(node.idList[i]); clearTimeout(node.idList[i]);
} }
node.idList = []; node.idList = [];
}); });
} }
} }
RED.nodes.registerType("delay",DelayNode); RED.nodes.registerType("delay",DelayNode);

View File

@ -203,7 +203,8 @@
"timed": "releases per" "timed": "releases per"
}, },
"error": { "error": {
"buffer": "buffer exceeded 1000 messages" "buffer": "buffer exceeded 1000 messages",
"buffer1": "buffer exceeded 10000 messages"
} }
}, },
"trigger": { "trigger": {