@riddix/hamh 2.1.0-alpha.779 → 2.1.0-alpha.781
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/backend/cli.js
CHANGED
|
@@ -131132,8 +131132,15 @@ var BridgeService = class _BridgeService extends Service {
|
|
|
131132
131132
|
static MAX_RECOVERY_HISTORY = 20;
|
|
131133
131133
|
static REACTIVE_DEBOUNCE_MS = 5e3;
|
|
131134
131134
|
async initialize() {
|
|
131135
|
-
for (const data of this.bridgeStorage.bridges) {
|
|
131136
|
-
|
|
131135
|
+
for (const data of [...this.bridgeStorage.bridges]) {
|
|
131136
|
+
let normalized = this.normalizeBridgeData(data);
|
|
131137
|
+
if (this.portUsed(normalized.port)) {
|
|
131138
|
+
const freePort = this.getNextAvailablePort(normalized.port);
|
|
131139
|
+
this.log.warn(
|
|
131140
|
+
`Bridge ${normalized.name} port ${normalized.port} already in use, moved to ${freePort}`
|
|
131141
|
+
);
|
|
131142
|
+
normalized = { ...normalized, port: freePort };
|
|
131143
|
+
}
|
|
131137
131144
|
await this.bridgeStorage.add(normalized);
|
|
131138
131145
|
await this.addBridge(normalized);
|
|
131139
131146
|
}
|
|
@@ -165023,9 +165030,20 @@ var ServerModeBridge = class {
|
|
|
165023
165030
|
const sessionManager = this.server.env.get(SessionManager);
|
|
165024
165031
|
const sessions = [...sessionManager.sessions];
|
|
165025
165032
|
let totalSubscriptions = 0;
|
|
165033
|
+
const fabricMap = /* @__PURE__ */ new Map();
|
|
165026
165034
|
const sessionList = sessions.map((s) => {
|
|
165027
165035
|
const subCount = s.subscriptions.size;
|
|
165028
165036
|
totalSubscriptions += subCount;
|
|
165037
|
+
const fi = typeof s.fabric?.fabricIndex === "number" ? s.fabric.fabricIndex : null;
|
|
165038
|
+
if (fi !== null) {
|
|
165039
|
+
const existing = fabricMap.get(fi) ?? {
|
|
165040
|
+
sessions: 0,
|
|
165041
|
+
subscriptions: 0
|
|
165042
|
+
};
|
|
165043
|
+
existing.sessions++;
|
|
165044
|
+
existing.subscriptions += subCount;
|
|
165045
|
+
fabricMap.set(fi, existing);
|
|
165046
|
+
}
|
|
165029
165047
|
const nowMs = Date.now();
|
|
165030
165048
|
const lastActiveMsAgo = typeof s.activeTimestamp === "number" && s.activeTimestamp > 0 ? nowMs - s.activeTimestamp : null;
|
|
165031
165049
|
const lastAnyActivityMsAgo = typeof s.timestamp === "number" ? nowMs - s.timestamp : null;
|
|
@@ -165033,6 +165051,7 @@ var ServerModeBridge = class {
|
|
|
165033
165051
|
return {
|
|
165034
165052
|
id: s.id,
|
|
165035
165053
|
peerNodeId: String(s.peerNodeId),
|
|
165054
|
+
fabricIndex: fi,
|
|
165036
165055
|
subscriptionCount: subCount,
|
|
165037
165056
|
lastActiveMsAgo,
|
|
165038
165057
|
lastAnyActivityMsAgo,
|
|
@@ -165040,16 +165059,23 @@ var ServerModeBridge = class {
|
|
|
165040
165059
|
ageMsFromOpen: startedAt != null ? nowMs - startedAt : null
|
|
165041
165060
|
};
|
|
165042
165061
|
});
|
|
165062
|
+
const fabrics = [...fabricMap.entries()].map(([fabricIndex, data]) => ({
|
|
165063
|
+
fabricIndex,
|
|
165064
|
+
sessions: data.sessions,
|
|
165065
|
+
subscriptions: data.subscriptions
|
|
165066
|
+
}));
|
|
165043
165067
|
return {
|
|
165044
165068
|
sessions: sessionList,
|
|
165045
165069
|
totalSessions: sessions.length,
|
|
165046
|
-
totalSubscriptions
|
|
165070
|
+
totalSubscriptions,
|
|
165071
|
+
fabrics
|
|
165047
165072
|
};
|
|
165048
165073
|
} catch {
|
|
165049
165074
|
return {
|
|
165050
165075
|
sessions: [],
|
|
165051
165076
|
totalSessions: 0,
|
|
165052
|
-
totalSubscriptions: 0
|
|
165077
|
+
totalSubscriptions: 0,
|
|
165078
|
+
fabrics: []
|
|
165053
165079
|
};
|
|
165054
165080
|
}
|
|
165055
165081
|
}
|