Files
sor/Server
14a467dc69 Fix 1: Move SpectatorRegistryService from in-memory to Redis Sets
Spectator registrations were held in a per-process ConcurrentDictionary,
causing spectators to miss updates when game actions were handled by a
different pod than the one that processed game.spectate.

Changes:
- SpectatorRegistryService: replace ConcurrentDictionary with Redis Set
  operations (SADD/SREM/SMEMBERS/DEL) via IConnectionMultiplexer.
  All four methods are now async (RegisterAsync, UnregisterAsync,
  GetSpectatorsAsync, RemoveSessionAsync). TTL of 24h on each SADD
  for self-expiry on abnormal session end.
- RedisKeys: add SpectatorSet(Guid sessionId) -> "spectators:{id}"
- SOR.Game.csproj: add StackExchange.Redis package reference
- GameHandlerBase: all GetSpectators/RemoveSession call sites updated
  to await the new async methods (BroadcastToAllViewersAsync,
  PushStateToPlayersAsync x3, FinalizeGame x2, BroadcastPlayerEliminated)
- GameSpectateHandler: await RegisterAsync
- GameStopSpectatingHandler: make HandleAsync truly async, await UnregisterAsync
- ServiceRegistration: update comment to reflect Redis backing

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-05-20 19:47:15 -04:00
..