@5minds/node-red-contrib-processcube 1.16.0 → 1.16.1-develop-136f5e-mh90amev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,16 +28,16 @@ module.exports = function (RED) {
28
28
  options['workerId'] = this.workername;
29
29
  }
30
30
 
31
- if (!options['lockDuration'] && process.env.NODE_RED_ETW_LOCK_DURATION) {
32
- options['lockDuration'] = parseInt(process.env.NODE_RED_ETW_LOCK_DURATION) || undefined;
31
+ if (!options['lockDuration'] && (process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION)) {
32
+ options['lockDuration'] = parseInt(process.env.NODE_RED_ETW_LOCK_DURATION) || parseInt(process.env.NODERED_ETW_LOCK_DURATION) || undefined;
33
33
  }
34
34
 
35
35
  if (!options['longpollingTimeout']) {
36
- options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT) || undefined;
36
+ options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT) || parseInt(process.env.NODERED_ETW_LONGPOLLING_TIMEOUT) || undefined;
37
37
  }
38
38
 
39
39
  if (!options['idleTimeout']) {
40
- options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT) || undefined;
40
+ options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT) || parseInt(process.env.NODERED_ETW_IDLE_TIMEOUT) || undefined;
41
41
  }
42
42
 
43
43
  node._subscribed = true;
@@ -164,7 +164,7 @@ module.exports = function (RED) {
164
164
  }
165
165
  };
166
166
 
167
- RED.hooks.add('preDeliver', (sendEvent) => {
167
+ const onPreDeliver = (sendEvent) => {
168
168
  if (node.isHandling() && node.ownMessage(sendEvent.msg)) {
169
169
 
170
170
  const sourceNode = sendEvent?.source?.node;
@@ -185,14 +185,15 @@ module.exports = function (RED) {
185
185
 
186
186
  node.traceExecution(debugMsg);
187
187
 
188
- if (process.env.NODE_RED_ETW_STEP_LOGGING == 'true') {
188
+ if (process.env.NODE_RED_ETW_STEP_LOGGING == 'true' || process.env.NODERED_ETW_STEP_LOGGING == 'true') {
189
189
  node._trace = `'${sourceNode.name || sourceNode.type}'->'${destinationNode.name || destinationNode.type}'`;
190
190
  node.log(`preDeliver: ${node._trace}`);
191
191
  }
192
192
  }
193
- });
193
+ };
194
+ RED.hooks.add('preDeliver', onPreDeliver);
194
195
 
195
- RED.hooks.add('postDeliver', (sendEvent) => {
196
+ const onPostDeliver = (sendEvent) => {
196
197
  if (node.isHandling() && node.ownMessage(sendEvent.msg)) {
197
198
  const sourceNode = sendEvent?.source?.node;
198
199
  const destinationNode = sendEvent?.destination?.node;
@@ -211,12 +212,13 @@ module.exports = function (RED) {
211
212
 
212
213
  node.traceExecution(debugMsg);
213
214
 
214
- if (process.env.NODE_RED_ETW_STEP_LOGGING == 'true') {
215
+ if (process.env.NODE_RED_ETW_STEP_LOGGING == 'true' || process.env.NODERED_ETW_STEP_LOGGING == 'true') {
215
216
  node._trace = `'${sourceNode.name || sourceNode.type}'->'${destinationNode.name || destinationNode.type}'`;
216
217
  node.log(`postDeliver: ${node._trace}`);
217
218
  }
218
219
  }
219
- });
220
+ };
221
+ RED.hooks.add('postDeliver', onPostDeliver);
220
222
 
221
223
  node.setSubscribedStatus = () => {
222
224
  this._subscribed = true;
@@ -440,7 +442,7 @@ module.exports = function (RED) {
440
442
  externalTaskWorker.onHeartbeat((event, external_task_id) => {
441
443
  node.setSubscribedStatus();
442
444
 
443
- if (process.env.NODE_RED_ETW_HEARTBEAT_LOGGING == 'true') {
445
+ if (process.env.NODE_RED_ETW_HEARTBEAT_LOGGING == 'true' || process.env.NODERED_ETW_HEARTBEAT_LOGGING == 'true') {
444
446
  if (external_task_id) {
445
447
  this.log(`subscription (heartbeat:topic ${node.topic}, ${event} for ${external_task_id}).`);
446
448
  } else {
@@ -460,7 +462,7 @@ module.exports = function (RED) {
460
462
 
461
463
  node.setUnsubscribedStatus(error);
462
464
 
463
- if (process.env.NODE_RED_ETW_STOP_IF_FAILED == 'true') {
465
+ if (process.env.NODE_RED_ETW_STOP_IF_FAILED == 'true' || process.env.NODERED_ETW_STOP_IF_FAILED == 'true') {
464
466
  // abort the external task MM: waiting for a fix in the client.ts
465
467
  externalTaskWorker.abortExternalTaskIfPresent(externalTask.id);
466
468
  // mark the external task as finished, cause it is gone
@@ -486,7 +488,10 @@ module.exports = function (RED) {
486
488
 
487
489
  node.on('close', () => {
488
490
  try {
491
+ RED.hooks.remove('preDeliver', onPreDeliver);
492
+ RED.hooks.remove('postDeliver', onPostDeliver);
489
493
  externalTaskWorker.stop();
494
+ node.log('External Task Worker closed.');
490
495
  } catch {
491
496
  node.error('Client close failed', {});
492
497
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.16.0",
3
+ "version": "1.16.1-develop-136f5e-mh90amev",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {