From 71da8a94dbf32955f04dd61bd9abb3baf4efe53f Mon Sep 17 00:00:00 2001 From: eleith Date: Fri, 30 Oct 2026 11:42:49 -0700 Subject: [PATCH] fix(web): stop config watcher on native shutdown Retain the existing watcher cleanup and invoke it once from adapter-node's post-HTTP shutdown event. Preserve reload behavior, shared watcher implementation and worker lifecycle. --- .changeset/stop-web-config-watcher.md | 5 +++++ apps/web/src/lib/server/boot.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/stop-web-config-watcher.md diff --git a/.changeset/stop-web-config-watcher.md b/.changeset/stop-web-config-watcher.md new file mode 100644 index 00000000..dc740e09 --- /dev/null +++ b/.changeset/stop-web-config-watcher.md @@ -0,0 +1,5 @@ +--- +'@when/web': patch +--- + +Stop the configuration watcher after native server shutdown so the web process can exit cleanly. diff --git a/apps/web/src/lib/server/boot.ts b/apps/web/src/lib/server/boot.ts index 3dc65524..8725eb48 100644 --- a/apps/web/src/lib/server/boot.ts +++ b/apps/web/src/lib/server/boot.ts @@ -20,11 +20,12 @@ export async function bootApp(): Promise { makeAuth(config); setState({ config, db }); - watchConfig((result) => + const stopWatching = watchConfig((result) => applyConfig(result, { current: () => getState().config, swap: (next) => setState({ config: next, db }), restart: () => process.exit(0) }) ); + process.once('sveltekit:shutdown', stopWatching); } -- 2.54.0