@5minds/node-red-contrib-processcube 1.5.9 → 1.5.10
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.
- package/externaltask-input.js +11 -4
- package/package.json +1 -1
- package/processcube-engine-config.js +10 -1
package/externaltask-input.js
CHANGED
@@ -27,16 +27,20 @@ module.exports = function (RED) {
|
|
27
27
|
|
28
28
|
const engineEventEmitter = engine.eventEmitter;
|
29
29
|
|
30
|
-
engineEventEmitter.on('engine-client-dispose', () => {
|
31
|
-
engine.engineClient.externalTasks.removeSubscription(subscription, node.engine.identity);
|
32
|
-
});
|
33
|
-
|
34
30
|
engineEventEmitter.on('engine-client-changed', () => {
|
35
31
|
node.log('new engineClient received');
|
36
32
|
register();
|
37
33
|
});
|
38
34
|
|
39
35
|
const register = async () => {
|
36
|
+
if (node.etw) {
|
37
|
+
try {
|
38
|
+
node.etw.stop();
|
39
|
+
node.log(`old etw closed: ${JSON.stringify(node.etw)}`);
|
40
|
+
} catch (e) {
|
41
|
+
node.log(`cant close etw: ${JSON.stringify(node.etw)}`);
|
42
|
+
}
|
43
|
+
}
|
40
44
|
const client = engine.engineClient;
|
41
45
|
|
42
46
|
if (!client) {
|
@@ -127,6 +131,8 @@ module.exports = function (RED) {
|
|
127
131
|
.then(async (externalTaskWorker) => {
|
128
132
|
node.status({ fill: 'blue', shape: 'ring', text: 'subcribed' });
|
129
133
|
|
134
|
+
node.etw = externalTaskWorker;
|
135
|
+
|
130
136
|
externalTaskWorker.identity = engine.identity;
|
131
137
|
engine.registerOnIdentityChanged((identity) => {
|
132
138
|
externalTaskWorker.identity = identity;
|
@@ -161,6 +167,7 @@ module.exports = function (RED) {
|
|
161
167
|
|
162
168
|
try {
|
163
169
|
externalTaskWorker.start();
|
170
|
+
showStatus(node, Object.keys(started_external_tasks).length);
|
164
171
|
} catch (error) {
|
165
172
|
node.error(`Worker start 'externalTaskWorker.start' failed: ${error.message}`);
|
166
173
|
}
|
package/package.json
CHANGED
@@ -42,12 +42,21 @@ module.exports = function (RED) {
|
|
42
42
|
function periodicallyRefreshEngineClient(node, n, intervalMs) {
|
43
43
|
function refreshUrl() {
|
44
44
|
const newUrl = RED.util.evaluateNodeProperty(n.url, n.urlType, node);
|
45
|
+
const newClientId = RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node);
|
46
|
+
const newClientSecret = RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node);
|
45
47
|
|
46
|
-
if (
|
48
|
+
if (
|
49
|
+
node.url === newUrl &&
|
50
|
+
node.credentials.clientId === newClientId &&
|
51
|
+
node.credentials.clientSecret === newClientSecret
|
52
|
+
) {
|
47
53
|
return;
|
48
54
|
}
|
49
55
|
|
50
56
|
node.url = newUrl;
|
57
|
+
node.credentials.clientId = newClientId;
|
58
|
+
node.credentials.clientSecret = newClientSecret;
|
59
|
+
|
51
60
|
if (node.credentials.clientId && node.credentials.clientSecret) {
|
52
61
|
if (node.engineClient) {
|
53
62
|
node.eventEmitter.emit('engine-client-dispose');
|