Skip to content

Live match not visible: active_matches/live_match_ids mismatch after arena restart #39

Description

@ScavieFae

Problem

The live match viewer shows no matches despite one actively playing.

GET /health
{"status":"ok","queue_size":0,"active_matches":1,"live_match_ids":[]}

active_matches comes from the DB (matches WHERE status = 'playing'), but live_match_ids comes from the in-memory _manager.match_info dict. After an arena restart (e.g. Railway redeploy), the DB retains the playing match but the WebSocket manager's in-memory state is lost.

The website uses live_match_ids to populate the viewer and the pulsing "LIVE" indicator in the header. With an empty array, both show nothing.

Root Cause

arena/server.py:863:

"live_match_ids": list(_manager.match_info.keys()),

_manager.match_info is populated only when a match_start WebSocket message arrives. If the arena restarts mid-match, this dict is empty even though the DB says a match is playing.

Suggested Fix

Fall back to the DB when _manager.match_info is empty:

live_ids = list(_manager.match_info.keys())
if not live_ids:
    # Recover from restart: use DB playing matches
    live_ids = db.get_playing_match_ids()

Or repopulate _manager.match_info on startup from DB state.

Impact

  • Website live viewer shows "No live matches" despite match playing
  • Header LIVE indicator doesn't pulse
  • Spectators can't find the match

Owner: Scav (arena code)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions