mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
stop delay node spamming web socket (when in fast rate limit mode)
This commit is contained in:
@@ -126,16 +126,14 @@ module.exports = function(RED) {
|
||||
if (!node.drop) {
|
||||
if ( node.intervalID !== -1) {
|
||||
node.buffer.push(msg);
|
||||
if (node.buffer.length > 0) {
|
||||
if ((node.rate >= 200) && (node.buffer.length > 0)) {
|
||||
node.status({text:node.buffer.length});
|
||||
}
|
||||
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 {
|
||||
if (!olddepth) {
|
||||
node.status({fill:"blue",shape:"dot"});
|
||||
olddepth = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -145,11 +143,10 @@ module.exports = function(RED) {
|
||||
clearInterval(node.intervalID);
|
||||
node.intervalID = -1;
|
||||
node.status({});
|
||||
olddepth = 0;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user