@5minds/node-red-contrib-processcube 1.5.8-subscription-logging-7c74e2-m42gyp9r → 1.5.8-subscription-logging-21e444-m42honbj

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.
@@ -41,6 +41,14 @@ module.exports = function (RED) {
41
41
  });
42
42
 
43
43
  const register = async () => {
44
+ if (node.etw) {
45
+ try {
46
+ node.etw.stop();
47
+ node.log(`old etw closed: ${JSON.stringify(node.etw)}`);
48
+ } catch (e) {
49
+ node.log(`cant close etw: ${JSON.stringify(node.etw)}`);
50
+ }
51
+ }
44
52
  node.log('registering node');
45
53
  const client = engine.engineClient;
46
54
  node.log(`subscribing to client: ${JSON.stringify(engine.engineClient)}`);
@@ -128,11 +136,14 @@ module.exports = function (RED) {
128
136
 
129
137
  let options = RED.util.evaluateNodeProperty(config.workerConfig, 'json', node);
130
138
 
139
+ node.log('opening new subscription');
131
140
  client.externalTasks
132
141
  .subscribeToExternalTaskTopic(config.topic, etwCallback, options)
133
142
  .then(async (externalTaskWorker) => {
134
143
  node.status({ fill: 'blue', shape: 'ring', text: 'subcribed' });
135
144
 
145
+ node.etw = externalTaskWorker;
146
+
136
147
  externalTaskWorker.identity = engine.identity;
137
148
  engine.registerOnIdentityChanged((identity) => {
138
149
  externalTaskWorker.identity = identity;
@@ -167,6 +178,7 @@ module.exports = function (RED) {
167
178
 
168
179
  try {
169
180
  externalTaskWorker.start();
181
+ node.log(`new etw started: ${JSON.stringify(externalTaskWorker)}`);
170
182
  } catch (error) {
171
183
  node.error(`Worker start 'externalTaskWorker.start' failed: ${error.message}`);
172
184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.5.8-subscription-logging-7c74e2-m42gyp9r",
3
+ "version": "1.5.8-subscription-logging-21e444-m42honbj",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {