Preserve room sessions across deploys#178
Draft
coder13 wants to merge 2 commits into
Draft
Conversation
Delay disconnect cleanup while clients reconnect and reconcile membership through the shared Redis adapter. Deploy application services sequentially without recreating stateful dependencies.
Expose dependency-aware HTTP readiness endpoints and a Socket.IO health round trip. Point Compose and nginx at the explicit health routes for deployment verification.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ROOM_RECONNECT_GRACE_MSRoot cause
Socket startup previously marked every normal room stale, cleared each user's
inRoomandwaitingForvalues, and removed the room admin. Normal socket disconnects also removed users immediately, while the APISIGINThandler dropped every user from every room. A routine process replacement could therefore mutate persistent race state before clients had time to reconnect.The previous container health checks only verified that the API returned a non-500 response and that Engine.IO accepted a polling handshake. They did not report whether MongoDB, PostgreSQL, or Redis were actually available.
Impact
Authenticated clients with the room page still open automatically reconnect and resume the same room within the grace window (60 seconds by default). The server verifies membership using the shared Redis adapter, so reconnects to another Socket.IO instance are recognized. Explicit leaves, kicks, and bans remain immediate.
The socket transport may briefly disconnect while its container is replaced, but that disconnect no longer ends the user's room session or advances room state.
Operators can query
/health/apiand/health/socketfor dependency-level readiness, or emithealth_checkon the default Socket.IO namespace to verify a real socket round trip. Compose now uses the explicit readiness endpoints.Validation
yarn lintyarn test(40 server tests and 17 client tests)yarn buildbash -n scripts/deploy.shdocker compose -f compose.yml -f compose.prod.yml config -qgit diff --check