Files
sor/Server
764a47b7d8 Fix: serialize concurrent game.ready with FOR UPDATE to prevent stuck Initializing sessions
Both players navigate to the game screen at the same time after match_found
and both send game.ready concurrently. Without row-level locking, each request
reads the other player's ready flag as false before the other's SaveChanges
commits, so neither handler ever sees both flags set — both return
WaitingForOpponent and the session stays Initializing forever.

Fix: wrap GameReadyHandler in an explicit transaction with SELECT … FOR UPDATE,
matching the same locking pattern already used by LoadActiveSessionAsync for
active-game mutations. The second request now blocks until the first commits,
then reads the updated ready flag and proceeds to initialize.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-03-09 18:06:00 -04:00
..