From 0db4ab1fede545b5fc893238acf2e471deb94fa8 Mon Sep 17 00:00:00 2001 From: realgnark <96846388+realgnark@users.noreply.github.com> Date: Thu, 13 Jan 2022 17:36:24 +0100 Subject: [PATCH] Update 28-tail.js --- storage/tail/28-tail.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/storage/tail/28-tail.js b/storage/tail/28-tail.js index 9031f8b9..0f741604 100644 --- a/storage/tail/28-tail.js +++ b/storage/tail/28-tail.js @@ -12,6 +12,8 @@ module.exports = function(RED) { this.split = new RegExp(n.split.replace(/\\r/g,'\r').replace(/\\n/g,'\n').replace(/\\t/g,'\t') || "[\r]{0,1}\n"); var node = this; + node.tout = null; + var fileTail = function() { if (fs.existsSync(node.filename)) { if (node.filetype === "text") { @@ -54,14 +56,14 @@ module.exports = function(RED) { }; var cancelRestart = function() { - if (node.tout) { + if (isRestartPending()) { clearTimeout(node.tout); node.tout = null; } }; var isRestartPending = function() { - return !!node.tout; + return node.tout !== null; }; if (node.filename !== "") {