fix(web): stop config watcher on native shutdown #109

Merged
eleith merged 1 commits from fix/web-watcher-shutdown into main 2026-10-30 18:48:34 +00:00
2 changed files with 7 additions and 1 deletions

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
'@when/web': patch
---
Stop the configuration watcher after native server shutdown so the web process can exit cleanly.
+2 -1
View File
@@ -20,11 +20,12 @@ export async function bootApp(): Promise<void> {
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);
}