From 5e9a815b068c416700d0d45c838a4fb61fd2c08e Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 2 Mar 2023 17:23:13 +0000 Subject: [PATCH] Clear link-call timeouts when node is closed Fixes #3959 --- .../node_modules/@node-red/nodes/core/common/60-link.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/node_modules/@node-red/nodes/core/common/60-link.js b/packages/node_modules/@node-red/nodes/core/common/60-link.js index c3473e8a1..f2c38b74c 100644 --- a/packages/node_modules/@node-red/nodes/core/common/60-link.js +++ b/packages/node_modules/@node-red/nodes/core/common/60-link.js @@ -248,6 +248,14 @@ module.exports = function(RED) { } }); + this.on("close", function () { + for (const event of Object.values(messageEvents)) { + if (event.ts) { + clearTimeout(event.ts) + } + } + }) + this.returnLinkMessage = function(eventId, msg) { if (Array.isArray(msg._linkSource) && msg._linkSource.length === 0) { delete msg._linkSource;