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); }