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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +7 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-web",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
5
  "description": "ework-web — standalone multi-project issue tracker. Local SQLite-backed, no external API dependency. Bun + TypeScript + SSR HTML.",
6
6
  "license": "MIT",
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` SIGTERMs us via the
209
- // pidfile and spawns a fresh process that re-reads the updated .env.
210
- // The ework-aio spawn is UNSAFE under systemd it would start a second process
211
- // on the same port so the INVOCATION_ID gate is load-bearing.
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
- const child = spawn("ework-aio", ["restart", "web"], {
217
+ spawn("ework-aio", ["restart", "web"], {
218
218
  detached: true,
219
219
  stdio: "ignore",
220
- });
221
- child.on("error", () => {
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`