Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

Rename vars NODE_RED -> NODERED; Disconnect hooks after Node is closed#92

Merged
moellenbeck merged 2 commits intomainfrom
develop
Oct 27, 2025
Merged

Rename vars NODE_RED -> NODERED; Disconnect hooks after Node is closed#92
moellenbeck merged 2 commits intomainfrom
develop

Conversation

@moellenbeck
Copy link
Member

@moellenbeck moellenbeck commented Oct 27, 2025

Pull Request Overview

This PR renames environment variables from NODE_RED_* to NODERED_* while maintaining backward compatibility, and fixes a memory leak by properly removing event hooks when the external task node is closed.

Key Changes:

  • Adds support for new NODERED_* environment variable naming convention alongside existing NODE_RED_* variables
  • Implements proper cleanup of preDeliver and postDeliver hooks in the node's close handler
  • Updates Node-RED version from 4.0.8 to 4.1.1

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Version bump to 1.16.1
externaltask-input.js Adds NODERED_* env var support, extracts hook callbacks to named functions, and removes hooks on node close
Dockerfile Updates base image to Node-RED 4.1.1-22
.processcube/nodered/.config.users.json Updates config for Node-RED 4.1.1 with new view settings
.processcube/nodered/.config.runtime.json Adds telemetry disabled flag
.processcube/nodered/.config.nodes.json Updates version references to 4.1.1 and 1.16.1

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@moellenbeck moellenbeck requested a review from Copilot October 27, 2025 10:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR renames environment variables from NODE_RED_* to NODERED_* while maintaining backward compatibility, and fixes a memory leak by properly removing event hooks when the external task node is closed.

Key Changes:

  • Adds support for new NODERED_* environment variable naming convention alongside existing NODE_RED_* variables
  • Implements proper cleanup of preDeliver and postDeliver hooks in the node's close handler
  • Updates Node-RED version from 4.0.8 to 4.1.1

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Version bump to 1.16.1
externaltask-input.js Adds NODERED_* env var support, extracts hook callbacks to named functions, and removes hooks on node close
Dockerfile Updates base image to Node-RED 4.1.1-22
.processcube/nodered/.config.users.json Updates config for Node-RED 4.1.1 with new view settings
.processcube/nodered/.config.runtime.json Adds telemetry disabled flag
.processcube/nodered/.config.nodes.json Updates version references to 4.1.1 and 1.16.1

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +31 to +32
if (!options['lockDuration'] && (process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION)) {
options['lockDuration'] = parseInt(process.env.NODE_RED_ETW_LOCK_DURATION) || parseInt(process.env.NODERED_ETW_LOCK_DURATION) || undefined;
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition checks for the existence of either environment variable, but the assignment attempts to parse both even when only one exists. Consider using a more efficient approach that avoids unnecessary parseInt calls: options['lockDuration'] = parseInt(process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION) || undefined;

Copilot uses AI. Check for mistakes.

if (!options['longpollingTimeout']) {
options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT) || undefined;
options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT) || parseInt(process.env.NODERED_ETW_LONGPOLLING_TIMEOUT) || undefined;
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code unnecessarily calls parseInt twice. Use a single parseInt call with the OR operator inside: parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT || process.env.NODERED_ETW_LONGPOLLING_TIMEOUT) || undefined

Suggested change
options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT) || parseInt(process.env.NODERED_ETW_LONGPOLLING_TIMEOUT) || undefined;
options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT || process.env.NODERED_ETW_LONGPOLLING_TIMEOUT) || undefined;

Copilot uses AI. Check for mistakes.

if (!options['idleTimeout']) {
options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT) || undefined;
options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT) || parseInt(process.env.NODERED_ETW_IDLE_TIMEOUT) || undefined;
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code unnecessarily calls parseInt twice. Use a single parseInt call with the OR operator inside: parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT || process.env.NODERED_ETW_IDLE_TIMEOUT) || undefined

Suggested change
options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT) || parseInt(process.env.NODERED_ETW_IDLE_TIMEOUT) || undefined;
options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT || process.env.NODERED_ETW_IDLE_TIMEOUT) || undefined;

Copilot uses AI. Check for mistakes.
@moellenbeck moellenbeck requested a review from Copilot October 27, 2025 10:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +31 to +32
if (!options['lockDuration'] && (process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION)) {
options['lockDuration'] = parseInt(process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION) || undefined;
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment variable check is duplicated. Store process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION in a constant to avoid repeating the logic and improve maintainability.

Suggested change
if (!options['lockDuration'] && (process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION)) {
options['lockDuration'] = parseInt(process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION) || undefined;
const LOCK_DURATION_ENV = process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION;
if (!options['lockDuration'] && LOCK_DURATION_ENV) {
options['lockDuration'] = parseInt(LOCK_DURATION_ENV) || undefined;

Copilot uses AI. Check for mistakes.

if (!options['longpollingTimeout']) {
options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT) || undefined;
options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT || process.env.NODERED_ETW_LONGPOLLING_TIMEOUT) || undefined;
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment variable check is duplicated. Store process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT || process.env.NODERED_ETW_LONGPOLLING_TIMEOUT in a constant to avoid repeating the logic and improve maintainability.

Copilot uses AI. Check for mistakes.

if (!options['idleTimeout']) {
options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT) || undefined;
options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT || process.env.NODERED_ETW_IDLE_TIMEOUT) || undefined;
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment variable check is duplicated. Store process.env.NODE_RED_ETW_IDLE_TIMEOUT || process.env.NODERED_ETW_IDLE_TIMEOUT in a constant to avoid repeating the logic and improve maintainability.

Copilot uses AI. Check for mistakes.
@moellenbeck moellenbeck merged commit 20e5fa6 into main Oct 27, 2025
2 checks passed
process-engine-ci added a commit that referenced this pull request Oct 27, 2025
# Changelog v1.16.1 (27.10.2025)

Dieser Changelog deckt die Änderungen zwischen folgenden Versionen ab: [v1.16.0 und v1.16.1](v1.16.0...v1.16.1).

Weitere Hinweise befinden sich im Changelog der vorherigen Version: [v1.16.0](https://github.com/5minds/node-red-contrib-processcube/releases/tag/v1.16.0).

## Merged Pull Requests

- #92 Rename vars NODE_RED -> NODERED; Disconnect hooks after Node is closed  (merged 27.10.2025)

[skip ci]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants