ework-web 0.4.2 → 0.4.3
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/package.json +1 -1
- package/src/index.ts +7 -12
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -205,25 +205,20 @@ function parseDbTargetOpts(payload: unknown): MysqlTargetOpts | { error: string
|
|
|
205
205
|
// Two restart paths depending on how this process was launched. Both run
|
|
206
206
|
// AFTER the HTTP response is sent (caller schedules this last):
|
|
207
207
|
// systemd (INVOCATION_ID set): exit → the unit's Restart=always brings us back
|
|
208
|
-
// PID-file mode (ework-aio start): `ework-aio restart web
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
//
|
|
208
|
+
// PID-file mode (ework-aio start): spawn `ework-aio restart web`, then exit.
|
|
209
|
+
// The restart child reads our PID file, finds a dead PID (stale), cleans
|
|
210
|
+
// up, and starts fresh. Always exiting avoids the race where the child
|
|
211
|
+
// SIGTERMs us while we're still serving the old config.
|
|
212
212
|
function scheduleRestart(): void {
|
|
213
213
|
if (process.env.INVOCATION_ID) {
|
|
214
214
|
setTimeout(() => process.exit(0), 750);
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
spawn("ework-aio", ["restart", "web"], {
|
|
218
218
|
detached: true,
|
|
219
219
|
stdio: "ignore",
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
// ework-aio not on PATH (dev mode) — best-effort exit; if no supervisor
|
|
223
|
-
// is watching, the admin restarts manually.
|
|
224
|
-
setTimeout(() => process.exit(0), 750);
|
|
225
|
-
});
|
|
226
|
-
child.unref();
|
|
220
|
+
}).unref();
|
|
221
|
+
setTimeout(() => process.exit(0), 1500);
|
|
227
222
|
}
|
|
228
223
|
|
|
229
224
|
// The daemon's `issues` table (thin ref) collides with the web's `issues`
|