@mostajs/setup 2.1.14 → 2.1.15
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/lib/setup.js +22 -2
- package/package.json +1 -1
package/dist/lib/setup.js
CHANGED
|
@@ -171,7 +171,7 @@ async function runNetInstall(installConfig, setupConfig) {
|
|
|
171
171
|
catch { }
|
|
172
172
|
}
|
|
173
173
|
if (schemasToSend.length > 0) {
|
|
174
|
-
// Send schemas to NET server
|
|
174
|
+
// Send schemas to NET server — it will restart to register routes
|
|
175
175
|
try {
|
|
176
176
|
const res = await fetch(`${installConfig.net.url}/api/upload-schemas-json`, {
|
|
177
177
|
method: 'POST',
|
|
@@ -179,8 +179,28 @@ async function runNetInstall(installConfig, setupConfig) {
|
|
|
179
179
|
body: JSON.stringify({ schemas: schemasToSend }),
|
|
180
180
|
});
|
|
181
181
|
const result = await res.json();
|
|
182
|
-
if (result.ok)
|
|
182
|
+
if (result.ok) {
|
|
183
183
|
seeded.push(`schemas (${schemasToSend.length})`);
|
|
184
|
+
// Si le serveur redémarre, attendre qu'il soit de retour
|
|
185
|
+
if (result.needsRestart) {
|
|
186
|
+
console.log('[Setup] Serveur NET redémarre pour charger les schemas...');
|
|
187
|
+
await new Promise(r => setTimeout(r, 2000)); // Laisser le temps au process.exit
|
|
188
|
+
// Poll health jusqu'à ce que le serveur soit de retour (max 30s)
|
|
189
|
+
for (let i = 0; i < 30; i++) {
|
|
190
|
+
try {
|
|
191
|
+
const h = await net.health();
|
|
192
|
+
if (h.entities?.length > 0) {
|
|
193
|
+
console.log(`[Setup] Serveur NET de retour (${h.entities.length} entités)`);
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch { }
|
|
198
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
199
|
+
}
|
|
200
|
+
// Recharger la collection map
|
|
201
|
+
await net.loadCollectionMap();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
184
204
|
}
|
|
185
205
|
catch (e) {
|
|
186
206
|
console.error('[Setup] Failed to upload schemas to NET server:', e);
|
package/package.json
CHANGED