@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/browser/index.js
CHANGED
|
@@ -531,6 +531,9 @@ function normalizeServiceInstanceDescriptor(value) {
|
|
|
531
531
|
health: raw.health ?? {},
|
|
532
532
|
isFrontend: Boolean(raw.isFrontend ?? raw.is_frontend ?? false),
|
|
533
533
|
isDatabase: Boolean(raw.isDatabase ?? raw.is_database ?? false),
|
|
534
|
+
isBootstrapPlaceholder: Boolean(
|
|
535
|
+
raw.isBootstrapPlaceholder ?? raw.is_bootstrap_placeholder ?? false
|
|
536
|
+
),
|
|
534
537
|
transports,
|
|
535
538
|
clientCreatedTransportIds: Array.isArray(raw.clientCreatedTransportIds) ? raw.clientCreatedTransportIds.map((entry) => normalizeString2(entry)).filter((entry) => entry.length > 0) : void 0
|
|
536
539
|
};
|
|
@@ -944,6 +947,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
944
947
|
health: ctx.health ?? ctx.__health ?? {},
|
|
945
948
|
numberOfRunningGraphs: ctx.numberOfRunningGraphs ?? ctx.__numberOfRunningGraphs ?? 0,
|
|
946
949
|
isPrimary: false,
|
|
950
|
+
isBootstrapPlaceholder: !!ctx.isBootstrapPlaceholder,
|
|
947
951
|
transports: ctx.transports ?? []
|
|
948
952
|
} : void 0)
|
|
949
953
|
);
|
|
@@ -998,6 +1002,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
998
1002
|
trackedInstance.acceptingWork = snapshot.acceptingWork;
|
|
999
1003
|
trackedInstance.reportedAt = trackedInstance.reportedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
1000
1004
|
}
|
|
1005
|
+
if (!serviceInstance.isBootstrapPlaceholder) {
|
|
1006
|
+
this.reconcileBootstrapPlaceholderInstance(serviceName, uuid5, emit);
|
|
1007
|
+
}
|
|
1001
1008
|
if (this.serviceName === serviceName) {
|
|
1002
1009
|
return false;
|
|
1003
1010
|
}
|
|
@@ -2361,6 +2368,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
2361
2368
|
reportedAt: instance?.reportedAt ?? null,
|
|
2362
2369
|
isDatabase: instance?.isDatabase,
|
|
2363
2370
|
isFrontend: instance?.isFrontend,
|
|
2371
|
+
isBootstrapPlaceholder: instance?.isBootstrapPlaceholder,
|
|
2364
2372
|
transports: (instance?.transports ?? []).map((transport) => ({
|
|
2365
2373
|
uuid: transport.uuid,
|
|
2366
2374
|
role: transport.role,
|
|
@@ -2527,6 +2535,39 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
2527
2535
|
this.missedHeartbeatsByInstance.delete(serviceInstanceId);
|
|
2528
2536
|
this.runtimeStatusFallbackInFlightByInstance.delete(serviceInstanceId);
|
|
2529
2537
|
}
|
|
2538
|
+
reconcileBootstrapPlaceholderInstance(serviceName, resolvedInstanceId, emit) {
|
|
2539
|
+
const instances = this.instances.get(serviceName);
|
|
2540
|
+
if (!instances?.length) {
|
|
2541
|
+
return;
|
|
2542
|
+
}
|
|
2543
|
+
const placeholders = instances.filter(
|
|
2544
|
+
(instance) => instance.uuid !== resolvedInstanceId && instance.isBootstrapPlaceholder
|
|
2545
|
+
);
|
|
2546
|
+
if (!placeholders.length) {
|
|
2547
|
+
return;
|
|
2548
|
+
}
|
|
2549
|
+
for (const placeholder of placeholders) {
|
|
2550
|
+
const wasDependee = this.dependeeByInstance.has(placeholder.uuid);
|
|
2551
|
+
const requiredForReadiness = this.readinessDependeeByInstance.has(
|
|
2552
|
+
placeholder.uuid
|
|
2553
|
+
);
|
|
2554
|
+
for (const transport of placeholder.transports) {
|
|
2555
|
+
const transportKey = buildTransportClientKey(transport);
|
|
2556
|
+
emit(`meta.socket_shutdown_requested:${transportKey}`, {});
|
|
2557
|
+
emit(`meta.fetch.destroy_requested:${transportKey}`, {});
|
|
2558
|
+
}
|
|
2559
|
+
this.unregisterDependee(placeholder.uuid, serviceName);
|
|
2560
|
+
if (wasDependee) {
|
|
2561
|
+
this.registerDependee(serviceName, resolvedInstanceId, {
|
|
2562
|
+
requiredForReadiness
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
this.instances.set(
|
|
2567
|
+
serviceName,
|
|
2568
|
+
instances.filter((instance) => !instance.isBootstrapPlaceholder)
|
|
2569
|
+
);
|
|
2570
|
+
}
|
|
2530
2571
|
getHeartbeatMisses(serviceInstanceId, now = Date.now()) {
|
|
2531
2572
|
const observedMisses = this.missedHeartbeatsByInstance.get(serviceInstanceId) ?? 0;
|
|
2532
2573
|
const lastHeartbeatAt = this.lastHeartbeatAtByInstance.get(serviceInstanceId) ?? 0;
|
|
@@ -7229,6 +7270,7 @@ var CadenzaService = class {
|
|
|
7229
7270
|
isBlocked: false,
|
|
7230
7271
|
health: {},
|
|
7231
7272
|
isFrontend: false,
|
|
7273
|
+
isBootstrapPlaceholder: true,
|
|
7232
7274
|
transports: resolvedBootstrapEndpoint ? [
|
|
7233
7275
|
this.createBootstrapTransport(
|
|
7234
7276
|
"cadenza-db",
|
|
@@ -7256,6 +7298,7 @@ var CadenzaService = class {
|
|
|
7256
7298
|
isBlocked: false,
|
|
7257
7299
|
health: {},
|
|
7258
7300
|
isFrontend: false,
|
|
7301
|
+
isBootstrapPlaceholder: true,
|
|
7259
7302
|
transports: relatedTransport ? [
|
|
7260
7303
|
{
|
|
7261
7304
|
uuid: `${service[0]}-${relatedTransport.role}`,
|