mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix delay rate limit last timing when empty
This commit is contained in:
parent
1af56a7f00
commit
cb2efb14f7
@ -275,6 +275,11 @@ module.exports = function(RED) {
|
|||||||
if (msg.hasOwnProperty("flush")) {
|
if (msg.hasOwnProperty("flush")) {
|
||||||
var len = node.buffer.length;
|
var len = node.buffer.length;
|
||||||
if (typeof(msg.flush) == 'number') { len = Math.min(Math.floor(msg.flush),len); }
|
if (typeof(msg.flush) == 'number') { len = Math.min(Math.floor(msg.flush),len); }
|
||||||
|
if (len === 0) {
|
||||||
|
clearInterval(node.intervalID);
|
||||||
|
node.intervalID = -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
const msgInfo = node.buffer.shift();
|
const msgInfo = node.buffer.shift();
|
||||||
if (Object.keys(msgInfo.msg).length > 1) {
|
if (Object.keys(msgInfo.msg).length > 1) {
|
||||||
@ -283,9 +288,8 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
len = len - 1;
|
len = len - 1;
|
||||||
}
|
}
|
||||||
if (node.buffer.length === 0) {
|
|
||||||
clearInterval(node.intervalID);
|
clearInterval(node.intervalID);
|
||||||
node.intervalID = -1;
|
node.intervalID = setInterval(sendMsgFromBuffer, node.rate);
|
||||||
}
|
}
|
||||||
node.status({fill:"blue",shape:"dot",text:node.buffer.length});
|
node.status({fill:"blue",shape:"dot",text:node.buffer.length});
|
||||||
done();
|
done();
|
||||||
|
Loading…
Reference in New Issue
Block a user