@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.js
CHANGED
|
@@ -329,6 +329,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
329
329
|
} else {
|
|
330
330
|
instances.push(serviceInstance);
|
|
331
331
|
}
|
|
332
|
+
if (this.serviceName === serviceName) {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
332
335
|
if (!isFrontend && this.deputies.has(serviceName) || this.remoteSignals.has(serviceName)) {
|
|
333
336
|
const clientCreated = instances?.some(
|
|
334
337
|
(i) => i.address === address && i.port === port && i.clientCreated && i.isActive
|
|
@@ -455,24 +458,25 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
455
458
|
this.handleServiceHandshakeTask = CadenzaService.createMetaTask(
|
|
456
459
|
"Handle service handshake",
|
|
457
460
|
(ctx, emit) => {
|
|
458
|
-
const { serviceName,
|
|
461
|
+
const { serviceName, serviceInstanceId } = ctx;
|
|
459
462
|
const serviceInstances = this.instances.get(serviceName);
|
|
460
|
-
const
|
|
461
|
-
(i) => i.
|
|
463
|
+
const instance = serviceInstances?.find(
|
|
464
|
+
(i) => i.uuid === serviceInstanceId
|
|
462
465
|
);
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
instance.isNonResponsive = false;
|
|
466
|
-
emit("global.meta.service_registry.service_handshake", {
|
|
467
|
-
data: {
|
|
468
|
-
isActive: instance.isActive,
|
|
469
|
-
isNonResponsive: instance.isNonResponsive
|
|
470
|
-
},
|
|
471
|
-
filter: {
|
|
472
|
-
uuid: instance.uuid
|
|
473
|
-
}
|
|
474
|
-
});
|
|
466
|
+
if (!instance) {
|
|
467
|
+
return false;
|
|
475
468
|
}
|
|
469
|
+
instance.isActive = true;
|
|
470
|
+
instance.isNonResponsive = false;
|
|
471
|
+
emit("global.meta.service_registry.service_handshake", {
|
|
472
|
+
data: {
|
|
473
|
+
isActive: instance.isActive,
|
|
474
|
+
isNonResponsive: instance.isNonResponsive
|
|
475
|
+
},
|
|
476
|
+
filter: {
|
|
477
|
+
uuid: instance.uuid
|
|
478
|
+
}
|
|
479
|
+
});
|
|
476
480
|
return true;
|
|
477
481
|
},
|
|
478
482
|
"Handles service handshake"
|
|
@@ -3276,7 +3280,10 @@ var DatabaseController = class _DatabaseController {
|
|
|
3276
3280
|
async updateFunction(tableName, context) {
|
|
3277
3281
|
const { data, filter = {}, transaction = true } = context;
|
|
3278
3282
|
if (!data || Object.keys(data).length === 0) {
|
|
3279
|
-
return {
|
|
3283
|
+
return {
|
|
3284
|
+
errored: true,
|
|
3285
|
+
__error: `No data provided for update of ${tableName}`
|
|
3286
|
+
};
|
|
3280
3287
|
}
|
|
3281
3288
|
let resultContext = {};
|
|
3282
3289
|
const client = transaction ? await this.getClient() : this.dbClient;
|