Files
hyperframes/packages
JamesandJerrai 3aab593152 fix(producer): tighten healthWorker startup race + shutdown semantics
Addresses Miga's review on #1733.

- server.ts: store the worker as a Promise<HealthWorkerHandle | null>
  instead of mutating a `let` from inside `.then`. A SIGTERM landing
  before the `.then` callback fired would previously see `healthWorker
  === null` and skip cleanup. shutdown() now `await`s the promise with
  a bounded 1.5s timeout so a hung-startup worker can't keep SIGTERM
  waiting (worker.terminate() from process exit still kills it).
- healthWorkerThread.ts: replace `process.exit()` inside the worker
  with `parentPort.close()` + natural event-loop drain. Node-version
  semantics for `process.exit()` from a worker have been historically
  inconsistent; the documented clean path is to close the channel and
  let the worker exit naturally. Also drops the redundant 2s force-exit
  on shutdown — the parent already owns the authoritative deadline via
  Promise.race + worker.terminate(), so the worker-side timer was
  belt-and-suspenders noise.

Co-Authored-By: Jerrai <noreply@anthropic.com>

— Jerrai
2026-06-26 15:04:47 +00:00
..
2026-06-26 00:51:34 -04:00
2026-06-26 00:51:34 -04:00
2026-06-26 00:51:34 -04:00
2026-06-26 00:51:34 -04:00
2026-06-26 00:51:34 -04:00
2026-06-16 13:16:09 -04:00
2026-06-26 00:51:34 -04:00