diff --git a/packages/node_modules/@node-red/nodes/core/sequence/19-batch.js b/packages/node_modules/@node-red/nodes/core/sequence/19-batch.js index 52cdb71bd..77574f222 100644 --- a/packages/node_modules/@node-red/nodes/core/sequence/19-batch.js +++ b/packages/node_modules/@node-red/nodes/core/sequence/19-batch.js @@ -213,13 +213,20 @@ module.exports = function(RED) { send_interval(node, allow_empty_seq); node.pending_count = 0; } - var timer = setInterval(msgHandler, interval); + var timer = undefined; + if (interval > 0) { + timer = setInterval(msgHandler, interval); + } this.on("input", function(msg) { if (msg.hasOwnProperty("reset")) { - clearInterval(timer); + if (timer !== undefined) { + clearInterval(timer); + } node.pending = []; node.pending_count = 0; - timer = setInterval(msgHandler, interval); + if (interval > 0) { + timer = setInterval(msgHandler, interval); + } return; } node.pending.push(msg); @@ -232,7 +239,9 @@ module.exports = function(RED) { } }); this.on("close", function() { - clearInterval(timer); + if (timer !== undefined) { + clearInterval(timer); + } node.pending = []; node.pending_count = 0; });