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:
parent
d82fe95076
commit
1cfad27d6f
@ -101,6 +101,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
|
||||
} else if (node.pauseType === "rate") {
|
||||
var olddepth = 0;
|
||||
node.on("input", function(msg) {
|
||||
if (!node.drop) {
|
||||
if ( node.intervalID !== -1) {
|
||||
@ -108,9 +109,14 @@ module.exports = function(RED) {
|
||||
if (node.buffer.length > 0) {
|
||||
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"));
|
||||
}
|
||||
if ((node.buffer.length > 10000) && (olddepth < 10000)) {
|
||||
olddepth = 10000;
|
||||
node.warn(node.name + " " + RED._("delay.error.buffer1"));
|
||||
}
|
||||
} else {
|
||||
node.send(msg);
|
||||
node.intervalID = setInterval(function() {
|
||||
@ -119,9 +125,9 @@ module.exports = function(RED) {
|
||||
node.intervalID = -1;
|
||||
node.status({});
|
||||
}
|
||||
|
||||
if (node.buffer.length > 0) {
|
||||
node.send(node.buffer.shift());
|
||||
if (node.buffer.length < 1000) { olddepth = 0; }
|
||||
node.status({text:node.buffer.length});
|
||||
}
|
||||
},node.rate);
|
||||
@ -190,14 +196,13 @@ module.exports = function(RED) {
|
||||
}, wait);
|
||||
node.idList.push(id);
|
||||
});
|
||||
|
||||
|
||||
node.on("close", function() {
|
||||
for (var i=0; i<node.idList.length; i++ ) {
|
||||
clearTimeout(node.idList[i]);
|
||||
}
|
||||
node.idList = [];
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
RED.nodes.registerType("delay",DelayNode);
|
||||
|
@ -203,7 +203,8 @@
|
||||
"timed": "releases per"
|
||||
},
|
||||
"error": {
|
||||
"buffer": "buffer exceeded 1000 messages"
|
||||
"buffer": "buffer exceeded 1000 messages",
|
||||
"buffer1": "buffer exceeded 10000 messages"
|
||||
}
|
||||
},
|
||||
"trigger": {
|
||||
|
Loading…
Reference in New Issue
Block a user