@cadenza.io/service 2.2.3 → 2.2.4
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/dist/index.js +23 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -281,6 +281,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
281
281
|
} else {
|
|
282
282
|
instances.push(serviceInstance);
|
|
283
283
|
}
|
|
284
|
+
if (this.serviceName === serviceName) {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
284
287
|
if (!isFrontend && this.deputies.has(serviceName) || this.remoteSignals.has(serviceName)) {
|
|
285
288
|
const clientCreated = instances?.some(
|
|
286
289
|
(i) => i.address === address && i.port === port && i.clientCreated && i.isActive
|
|
@@ -407,24 +410,25 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
407
410
|
this.handleServiceHandshakeTask = CadenzaService.createMetaTask(
|
|
408
411
|
"Handle service handshake",
|
|
409
412
|
(ctx, emit) => {
|
|
410
|
-
const { serviceName,
|
|
413
|
+
const { serviceName, serviceInstanceId } = ctx;
|
|
411
414
|
const serviceInstances = this.instances.get(serviceName);
|
|
412
|
-
const
|
|
413
|
-
(i) => i.
|
|
415
|
+
const instance = serviceInstances?.find(
|
|
416
|
+
(i) => i.uuid === serviceInstanceId
|
|
414
417
|
);
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
instance.isNonResponsive = false;
|
|
418
|
-
emit("global.meta.service_registry.service_handshake", {
|
|
419
|
-
data: {
|
|
420
|
-
isActive: instance.isActive,
|
|
421
|
-
isNonResponsive: instance.isNonResponsive
|
|
422
|
-
},
|
|
423
|
-
filter: {
|
|
424
|
-
uuid: instance.uuid
|
|
425
|
-
}
|
|
426
|
-
});
|
|
418
|
+
if (!instance) {
|
|
419
|
+
return false;
|
|
427
420
|
}
|
|
421
|
+
instance.isActive = true;
|
|
422
|
+
instance.isNonResponsive = false;
|
|
423
|
+
emit("global.meta.service_registry.service_handshake", {
|
|
424
|
+
data: {
|
|
425
|
+
isActive: instance.isActive,
|
|
426
|
+
isNonResponsive: instance.isNonResponsive
|
|
427
|
+
},
|
|
428
|
+
filter: {
|
|
429
|
+
uuid: instance.uuid
|
|
430
|
+
}
|
|
431
|
+
});
|
|
428
432
|
return true;
|
|
429
433
|
},
|
|
430
434
|
"Handles service handshake"
|
|
@@ -3228,7 +3232,10 @@ var DatabaseController = class _DatabaseController {
|
|
|
3228
3232
|
async updateFunction(tableName, context) {
|
|
3229
3233
|
const { data, filter = {}, transaction = true } = context;
|
|
3230
3234
|
if (!data || Object.keys(data).length === 0) {
|
|
3231
|
-
return {
|
|
3235
|
+
return {
|
|
3236
|
+
errored: true,
|
|
3237
|
+
__error: `No data provided for update of ${tableName}`
|
|
3238
|
+
};
|
|
3232
3239
|
}
|
|
3233
3240
|
let resultContext = {};
|
|
3234
3241
|
const client = transaction ? await this.getClient() : this.dbClient;
|