@5minds/node-red-contrib-processcube 1.5.8-develop-ad14a2-m3r3tfjk → 1.5.8-subscription-logging-0c78a6-m41fdsmp

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.
@@ -27,8 +27,12 @@ module.exports = function (RED) {
27
27
 
28
28
  const engineEventEmitter = engine.eventEmitter;
29
29
 
30
+ node.log(`got event emmiter: ${engineEventEmitter}`);
31
+
30
32
  engineEventEmitter.on('engine-client-dispose', () => {
31
- engine.engineClient.externalTasks.removeSubscription(subscription, node.engine.identity);
33
+ node.log('rm subsctiption');
34
+ engine.engineClient.externalTasks.removeSubscription(subscription, engine.identity);
35
+ node.log('done rm subscriptions');
32
36
  });
33
37
 
34
38
  engineEventEmitter.on('engine-client-changed', () => {
@@ -37,7 +41,9 @@ module.exports = function (RED) {
37
41
  });
38
42
 
39
43
  const register = async () => {
44
+ node.log('registering node');
40
45
  const client = engine.engineClient;
46
+ node.log(`subscribing to client: ${engine.engineClient}`);
41
47
 
42
48
  if (!client) {
43
49
  node.error('No engine configured.');
@@ -178,7 +184,8 @@ module.exports = function (RED) {
178
184
  });
179
185
  };
180
186
 
181
- if (node.engine) {
187
+ if (engine) {
188
+ node.log(`initial register: ${engine}`);
182
189
  register();
183
190
  }
184
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.5.8-develop-ad14a2-m3r3tfjk",
3
+ "version": "1.5.8-subscription-logging-0c78a6-m41fdsmp",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -40,31 +40,45 @@ module.exports = function (RED) {
40
40
  };
41
41
 
42
42
  function periodicallyRefreshEngineClient(node, n, intervalMs) {
43
+ node.log('starting refresh cycle');
43
44
  function refreshUrl() {
44
45
  const newUrl = RED.util.evaluateNodeProperty(n.url, n.urlType, node);
45
46
 
46
47
  if (node.url === newUrl) {
48
+ node.log('no new url found');
47
49
  return;
48
50
  }
49
51
 
52
+ node.log(`new url found: ${newUrl}`);
50
53
  node.url = newUrl;
51
54
  if (node.credentials.clientId && node.credentials.clientSecret) {
52
55
  if (node.engineClient) {
56
+ node.log('disposing old engine client');
53
57
  node.eventEmitter.emit('engine-client-dispose');
54
58
  node.engineClient.dispose();
55
59
  }
60
+
61
+ node.log('creating new engine client (without credentials)');
62
+
56
63
  node.engineClient = new engine_client.EngineClient(node.url, () =>
57
64
  getFreshIdentity(node.url, node)
58
65
  );
59
66
 
67
+ node.log(`new engine client: ${node.engineClient}`);
68
+
60
69
  node.eventEmitter.emit('engine-client-changed');
61
70
  } else {
62
71
  if (node.engineClient) {
72
+ node.log('disposing old engine client (without credentials)');
63
73
  node.eventEmitter.emit('engine-client-dispose');
64
74
  node.engineClient.dispose();
65
75
  }
76
+
77
+ node.log('creating new engine client (without credentials)');
66
78
  node.engineClient = new engine_client.EngineClient(node.url);
67
79
 
80
+ node.log(`new engine client (without credentials): ${node.engineClient}`);
81
+
68
82
  node.eventEmitter.emit('engine-client-changed');
69
83
  }
70
84
  }