@mmmbuto/nexuscrew 0.9.33 → 0.9.34
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/CHANGELOG.md +8 -0
- package/frontend/dist/assets/{index-Uco-EbNb.js → index-5eCvm3HF.js} +1 -1
- package/frontend/dist/index.html +1 -1
- package/frontend/dist/version.json +1 -1
- package/lib/fleet/builtin.js +60 -1
- package/lib/fleet/causes.js +3 -0
- package/lib/fleet/cell-exec.js +12 -12
- package/lib/fleet/cell-lease-server.js +4 -4
- package/lib/fleet/definitions.js +109 -6
- package/lib/fleet/managed.js +257 -3
- package/lib/fleet/runtime.js +7 -1
- package/lib/mcp/cells.js +21 -1
- package/package.json +1 -1
package/lib/mcp/cells.js
CHANGED
|
@@ -75,6 +75,10 @@ function topologyOwners(payload) {
|
|
|
75
75
|
route: [...node.route],
|
|
76
76
|
label: typeof node.label === 'string' && node.label ? node.label : (node.name || node.route.join(' › ')),
|
|
77
77
|
stale: node.stale === true,
|
|
78
|
+
// Serve alla directory per dire QUANDO un nodo stale e' stato visto
|
|
79
|
+
// l'ultima volta: senza, la voce in unavailable parlerebbe dello stato
|
|
80
|
+
// senza dire da quanto.
|
|
81
|
+
lastSeen: Number.isFinite(node.lastSeen) ? node.lastSeen : null,
|
|
78
82
|
});
|
|
79
83
|
}
|
|
80
84
|
return out;
|
|
@@ -162,10 +166,26 @@ async function readCellDirectory(ctx, callerSession = null) {
|
|
|
162
166
|
]);
|
|
163
167
|
const localId = String(config && config.instanceId || '');
|
|
164
168
|
if (!NODE_ID_RE.test(localId)) throw new Error('instanceId locale non disponibile');
|
|
169
|
+
const candidati = topologyOwners(topology).filter((owner) => owner.instanceId !== localId);
|
|
165
170
|
const owners = [{ instanceId: localId, route: [], label: 'Local', stale: false },
|
|
166
|
-
...
|
|
171
|
+
...candidati.filter((owner) => !owner.stale)];
|
|
167
172
|
const cells = [];
|
|
168
173
|
const unavailable = [];
|
|
174
|
+
// Un owner STALE resta nel gate (non si interroga un nodo che la topologia
|
|
175
|
+
// dichiara stantio) ma non SPARISCE dalla directory: chi legge `nc_cells`
|
|
176
|
+
// deve distinguere «questo nodo non risponde da X» da «questo nodo non
|
|
177
|
+
// esiste». Stesso shape di unavailableOwner, failure 'stale' + lastSeen.
|
|
178
|
+
for (const owner of candidati) {
|
|
179
|
+
if (!owner.stale) continue;
|
|
180
|
+
unavailable.push({
|
|
181
|
+
instanceId: owner.instanceId,
|
|
182
|
+
owner: owner.label,
|
|
183
|
+
route: owner.route.length ? owner.route.join('/') : 'local',
|
|
184
|
+
...(owner.route.length === 0 ? { local: true } : {}),
|
|
185
|
+
failure: 'stale',
|
|
186
|
+
lastSeen: Number.isFinite(owner.lastSeen) ? owner.lastSeen : null,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
169
189
|
await Promise.all(owners.map(async (owner) => {
|
|
170
190
|
const apiPath = owner.route.length ? routePath(owner.route, 'cells') : '/api/cells';
|
|
171
191
|
if (!apiPath) return;
|