Lobby state in Valkey (ephemeral) + PostgreSQL (durable) #37

Open
opened 2026-04-19 07:23:37 +00:00 by forgejo-lila · 0 comments
Owner

Context

Lobby state has ephemeral components (who's connected, current question, timer) and durable components (who played, final scores).

What to do

Use Valkey for live state, PostgreSQL for permanent records.

What goes where

Valkey (ephemeral, TTL-based):

  • Connected player list per lobby
  • Current question index
  • Timer state
  • Player answers for current round

PostgreSQL (durable):

  • Lobby record (lobbies table)
  • Player membership (lobby_players table)
  • Final scores
  • Game results (for stats)

Acceptance criteria

  • Live game state survives brief API hiccups
  • Game results permanently recorded in PostgreSQL
  • Valkey keys have TTLs to prevent stale state
  • If Valkey data lost, game can't continue but historical data preserved

Notes

Depends on: Valkey being added to production stack (see Valkey issue). The GameSessionStore interface can be extended or a new LobbyStateStore interface created.

## Context Lobby state has ephemeral components (who's connected, current question, timer) and durable components (who played, final scores). ## What to do Use Valkey for live state, PostgreSQL for permanent records. ## What goes where **Valkey (ephemeral, TTL-based):** - Connected player list per lobby - Current question index - Timer state - Player answers for current round **PostgreSQL (durable):** - Lobby record (lobbies table) - Player membership (lobby_players table) - Final scores - Game results (for stats) ## Acceptance criteria - Live game state survives brief API hiccups - Game results permanently recorded in PostgreSQL - Valkey keys have TTLs to prevent stale state - If Valkey data lost, game can't continue but historical data preserved ## Notes Depends on: Valkey being added to production stack (see Valkey issue). The `GameSessionStore` interface can be extended or a new `LobbyStateStore` interface created.
forgejo-lila added the
multiplayer
label 2026-04-19 07:23:37 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: forgejo-lila/lila#37
No description provided.