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

Add logging function for queue size

This commit is contained in:
Kazuhito Yokoi 2019-09-27 17:04:19 +09:00
parent f81e0403ee
commit eb301d0b9d

View File

@ -92,6 +92,7 @@ module.exports = function(RED) {
this.randomID = -1; this.randomID = -1;
this.lastSent = null; this.lastSent = null;
this.drop = n.drop; this.drop = n.drop;
this.droppedMsgs = 0;
var node = this; var node = this;
function ourTimeout(handler, delay) { function ourTimeout(handler, delay) {
@ -137,6 +138,19 @@ module.exports = function(RED) {
} }
} }
setInterval(function () {
if (node.buffer.length !== 0) {
node.debug("node.buffer.length = " + node.buffer.length);
}
}, 15 * 1000);
setInterval(function () {
if (node.droppedMsgs !== 0) {
node.debug("node.droppedMsgs = " + node.droppedMsgs);
node.droppedMsgs = 0;
}
}, 15 * 1000);
if (node.pauseType === "delay") { if (node.pauseType === "delay") {
node.on("input", function(msg) { node.on("input", function(msg) {
if (msg.hasOwnProperty("flush")) { flushDelayList(); } if (msg.hasOwnProperty("flush")) { flushDelayList(); }
@ -218,6 +232,9 @@ module.exports = function(RED) {
} }
if (node.buffer.length < _maxKeptMsgsCount) { if (node.buffer.length < _maxKeptMsgsCount) {
node.buffer.push(msg); node.buffer.push(msg);
} else {
node.trace("dropped due to buffer overflow. msg._msgid = " + msg._msgid);
node.droppedMsgs++;
} }
} }
} else { } else {