diff --git a/packages/node_modules/@node-red/nodes/core/function/89-delay.js b/packages/node_modules/@node-red/nodes/core/function/89-delay.js index 079227194..a2245c4ab 100644 --- a/packages/node_modules/@node-red/nodes/core/function/89-delay.js +++ b/packages/node_modules/@node-red/nodes/core/function/89-delay.js @@ -192,6 +192,18 @@ module.exports = function(RED) { } else if (node.pauseType === "rate") { node.on("input", function(msg) { + if (msg.nodeMessageBufferMaxLength) { + node.debug("msg.nodeMessageBufferMaxLength = " + msg.nodeMessageBufferMaxLength); + if (msg.nodeMessageBufferMaxLength == 0) { + clearInterval(node.intervalID); + node.intervalID = -1; + node.buffer = []; + } else if (msg.nodeMessageBufferMaxLength < node.buffer.length) { + node.buffer = node.buffer.splice(msg.nodeMessageBufferMaxLength, + node.buffer.length - msg.nodeMessageBufferMaxLength); + } + _maxKeptMsgsCount = msg.nodeMessageBufferMaxLength; + } if (!node.drop) { if (node.intervalID !== -1) { if (msg.hasOwnProperty("rate") && node.rate !== msg.rate) {