Skip to content

server: wait for the stores to disconnect on stop - #74

Merged
msimerson merged 2 commits into
NicTool:mainfrom
aberoham:await-store-shutdown
Oct 12, 2026
Merged

msimerson merged 2 commits into
NicTool:mainfrom
aberoham:await-store-shutdown

Conversation

@aberoham

Copy link
Copy Markdown
Contributor

server.stop() resolved before User.disconnect() and Session.disconnect() finished, because hapi doesn't await server.events listeners. onPostStop runs inside stop(), so stop now waits for both.

routes/lifecycle.test.js holds User.disconnect() open and checks that stop() is still pending. It fails on main and passes here.

Tests: mysql 410/410, json 385/385, toml 385/385. Prettier is clean. eslint reports only the two existing warnings in routes/index.js.

hapi does not await server.events listeners, so server.stop() resolved
while User and Session were still disconnecting. onPostStop runs inside
stop(). routes/lifecycle.test.js fails on main and passes here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@msimerson
msimerson merged commit 0626011 into NicTool:main Oct 12, 2026
10 checks passed
@aberoham
aberoham deleted the await-store-shutdown branch October 13, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants