@cadenza.io/service 2.17.5 → 2.17.6
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/browser/index.js +43 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +43 -0
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -480,6 +480,9 @@ function normalizeServiceInstanceDescriptor(value) {
|
|
|
480
480
|
health: raw.health ?? {},
|
|
481
481
|
isFrontend: Boolean(raw.isFrontend ?? raw.is_frontend ?? false),
|
|
482
482
|
isDatabase: Boolean(raw.isDatabase ?? raw.is_database ?? false),
|
|
483
|
+
isBootstrapPlaceholder: Boolean(
|
|
484
|
+
raw.isBootstrapPlaceholder ?? raw.is_bootstrap_placeholder ?? false
|
|
485
|
+
),
|
|
483
486
|
transports,
|
|
484
487
|
clientCreatedTransportIds: Array.isArray(raw.clientCreatedTransportIds) ? raw.clientCreatedTransportIds.map((entry) => normalizeString2(entry)).filter((entry) => entry.length > 0) : void 0
|
|
485
488
|
};
|
|
@@ -893,6 +896,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
893
896
|
health: ctx.health ?? ctx.__health ?? {},
|
|
894
897
|
numberOfRunningGraphs: ctx.numberOfRunningGraphs ?? ctx.__numberOfRunningGraphs ?? 0,
|
|
895
898
|
isPrimary: false,
|
|
899
|
+
isBootstrapPlaceholder: !!ctx.isBootstrapPlaceholder,
|
|
896
900
|
transports: ctx.transports ?? []
|
|
897
901
|
} : void 0)
|
|
898
902
|
);
|
|
@@ -947,6 +951,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
947
951
|
trackedInstance.acceptingWork = snapshot.acceptingWork;
|
|
948
952
|
trackedInstance.reportedAt = trackedInstance.reportedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
949
953
|
}
|
|
954
|
+
if (!serviceInstance.isBootstrapPlaceholder) {
|
|
955
|
+
this.reconcileBootstrapPlaceholderInstance(serviceName, uuid5, emit);
|
|
956
|
+
}
|
|
950
957
|
if (this.serviceName === serviceName) {
|
|
951
958
|
return false;
|
|
952
959
|
}
|
|
@@ -2310,6 +2317,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
2310
2317
|
reportedAt: instance?.reportedAt ?? null,
|
|
2311
2318
|
isDatabase: instance?.isDatabase,
|
|
2312
2319
|
isFrontend: instance?.isFrontend,
|
|
2320
|
+
isBootstrapPlaceholder: instance?.isBootstrapPlaceholder,
|
|
2313
2321
|
transports: (instance?.transports ?? []).map((transport) => ({
|
|
2314
2322
|
uuid: transport.uuid,
|
|
2315
2323
|
role: transport.role,
|
|
@@ -2476,6 +2484,39 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
2476
2484
|
this.missedHeartbeatsByInstance.delete(serviceInstanceId);
|
|
2477
2485
|
this.runtimeStatusFallbackInFlightByInstance.delete(serviceInstanceId);
|
|
2478
2486
|
}
|
|
2487
|
+
reconcileBootstrapPlaceholderInstance(serviceName, resolvedInstanceId, emit) {
|
|
2488
|
+
const instances = this.instances.get(serviceName);
|
|
2489
|
+
if (!instances?.length) {
|
|
2490
|
+
return;
|
|
2491
|
+
}
|
|
2492
|
+
const placeholders = instances.filter(
|
|
2493
|
+
(instance) => instance.uuid !== resolvedInstanceId && instance.isBootstrapPlaceholder
|
|
2494
|
+
);
|
|
2495
|
+
if (!placeholders.length) {
|
|
2496
|
+
return;
|
|
2497
|
+
}
|
|
2498
|
+
for (const placeholder of placeholders) {
|
|
2499
|
+
const wasDependee = this.dependeeByInstance.has(placeholder.uuid);
|
|
2500
|
+
const requiredForReadiness = this.readinessDependeeByInstance.has(
|
|
2501
|
+
placeholder.uuid
|
|
2502
|
+
);
|
|
2503
|
+
for (const transport of placeholder.transports) {
|
|
2504
|
+
const transportKey = buildTransportClientKey(transport);
|
|
2505
|
+
emit(`meta.socket_shutdown_requested:${transportKey}`, {});
|
|
2506
|
+
emit(`meta.fetch.destroy_requested:${transportKey}`, {});
|
|
2507
|
+
}
|
|
2508
|
+
this.unregisterDependee(placeholder.uuid, serviceName);
|
|
2509
|
+
if (wasDependee) {
|
|
2510
|
+
this.registerDependee(serviceName, resolvedInstanceId, {
|
|
2511
|
+
requiredForReadiness
|
|
2512
|
+
});
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
this.instances.set(
|
|
2516
|
+
serviceName,
|
|
2517
|
+
instances.filter((instance) => !instance.isBootstrapPlaceholder)
|
|
2518
|
+
);
|
|
2519
|
+
}
|
|
2479
2520
|
getHeartbeatMisses(serviceInstanceId, now = Date.now()) {
|
|
2480
2521
|
const observedMisses = this.missedHeartbeatsByInstance.get(serviceInstanceId) ?? 0;
|
|
2481
2522
|
const lastHeartbeatAt = this.lastHeartbeatAtByInstance.get(serviceInstanceId) ?? 0;
|
|
@@ -9564,6 +9605,7 @@ var CadenzaService = class {
|
|
|
9564
9605
|
isBlocked: false,
|
|
9565
9606
|
health: {},
|
|
9566
9607
|
isFrontend: false,
|
|
9608
|
+
isBootstrapPlaceholder: true,
|
|
9567
9609
|
transports: resolvedBootstrapEndpoint ? [
|
|
9568
9610
|
this.createBootstrapTransport(
|
|
9569
9611
|
"cadenza-db",
|
|
@@ -9591,6 +9633,7 @@ var CadenzaService = class {
|
|
|
9591
9633
|
isBlocked: false,
|
|
9592
9634
|
health: {},
|
|
9593
9635
|
isFrontend: false,
|
|
9636
|
+
isBootstrapPlaceholder: true,
|
|
9594
9637
|
transports: relatedTransport ? [
|
|
9595
9638
|
{
|
|
9596
9639
|
uuid: `${service[0]}-${relatedTransport.role}`,
|