From cf2d5841f5f0f256ddb8ad3bb49cafb83675031e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A5nsson?= Date: Wed, 25 Aug 2021 12:52:10 +0200 Subject: [PATCH 1/2] SPLIT Join node - support for payload.resetTimeout to restore original timeout --- .../@node-red/nodes/core/sequence/17-split.js | 13 +++++++++++++ .../nodes/locales/en-US/sequence/17-split.html | 1 + 2 files changed, 14 insertions(+) diff --git a/packages/node_modules/@node-red/nodes/core/sequence/17-split.js b/packages/node_modules/@node-red/nodes/core/sequence/17-split.js index e3e4377f5..d2b7fc226 100644 --- a/packages/node_modules/@node-red/nodes/core/sequence/17-split.js +++ b/packages/node_modules/@node-red/nodes/core/sequence/17-split.js @@ -631,6 +631,19 @@ module.exports = function(RED) { } } + if (msg.hasOwnProperty("resetTimeout")) { + if (inflight[partId]) { + if (inflight[partId].timeout) { + clearTimeout(inflight[partId].timeout); + } + if (node.timer > 0) { + inflight[partId].timeout = setTimeout(function() { + completeSend(partId) + }, node.timer) + } + } + } + if (msg.hasOwnProperty("reset")) { if (inflight[partId]) { if (inflight[partId].timeout) { diff --git a/packages/node_modules/@node-red/nodes/locales/en-US/sequence/17-split.html b/packages/node_modules/@node-red/nodes/locales/en-US/sequence/17-split.html index 3334ec126..51e8600db 100644 --- a/packages/node_modules/@node-red/nodes/locales/en-US/sequence/17-split.html +++ b/packages/node_modules/@node-red/nodes/locales/en-US/sequence/17-split.html @@ -118,6 +118,7 @@

A timeout can be set to trigger sending the new message using whatever has been received so far.

If a message is received with the msg.complete property set, the output message is finalised and sent. This resets any part counts.

+

If a message is received with the msg.resetTimeout property set, the timer for the partly complete message is reset to the original time.

If a message is received with the msg.reset property set, the partly complete message is deleted and not sent. This resets any part counts.

From f20565fd16088816627c85605d9cc41178331d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A5nsson?= Date: Wed, 25 Aug 2021 21:53:37 +0200 Subject: [PATCH 2/2] Renamed resetTimeout to restartTimeout Updated documentation differently --- .../node_modules/@node-red/nodes/core/sequence/17-split.js | 2 +- .../@node-red/nodes/locales/en-US/sequence/17-split.html | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/sequence/17-split.js b/packages/node_modules/@node-red/nodes/core/sequence/17-split.js index d2b7fc226..e158f344c 100644 --- a/packages/node_modules/@node-red/nodes/core/sequence/17-split.js +++ b/packages/node_modules/@node-red/nodes/core/sequence/17-split.js @@ -631,7 +631,7 @@ module.exports = function(RED) { } } - if (msg.hasOwnProperty("resetTimeout")) { + if (msg.hasOwnProperty("restartTimeout")) { if (inflight[partId]) { if (inflight[partId].timeout) { clearTimeout(inflight[partId].timeout); diff --git a/packages/node_modules/@node-red/nodes/locales/en-US/sequence/17-split.html b/packages/node_modules/@node-red/nodes/locales/en-US/sequence/17-split.html index 51e8600db..4884c96da 100644 --- a/packages/node_modules/@node-red/nodes/locales/en-US/sequence/17-split.html +++ b/packages/node_modules/@node-red/nodes/locales/en-US/sequence/17-split.html @@ -115,10 +115,9 @@

A count can be set for how many messages should be received before generating the output message. For object outputs, once this count has been reached, the node can be configured to send a message for each subsequent message received.

-

A timeout can be set to trigger sending the new message using whatever has been received so far.

+

A timeout can be set to trigger sending the new message using whatever has been received so far. This timeout can be restarted and set to its initial value by sending a message with the msg.restartTimeout property set.

If a message is received with the msg.complete property set, the output message is finalised and sent. This resets any part counts.

-

If a message is received with the msg.resetTimeout property set, the timer for the partly complete message is reset to the original time.

If a message is received with the msg.reset property set, the partly complete message is deleted and not sent. This resets any part counts.