fix(db): add LIMIT to fetchSeriesGames query to prevent OOMKill

The fetchSeriesGames function was querying all games for a series without a limit.
With up to 1000 series being fetched, and potentially many games per series,
this could return an unbounded number of rows and cause OOMKill.

A typical series has 3-7 games (best-of-5 or best-of-7), so LIMIT 100 is
more than sufficient to handle edge cases while preventing memory exhaustion.

Fixes acb-index-builder CrashLoopBackOff caused by OOMKill after web asset copy.
This commit is contained in:
jedarden 2026-06-25 01:46:54 -04:00
parent 68b786416a
commit ca48b60434

View file

@ -522,6 +522,7 @@ func fetchSeriesGames(ctx context.Context, db *sql.DB, seriesID int64) ([]Series
LEFT JOIN matches m ON sg.match_id = m.match_id
WHERE sg.series_id = $1
ORDER BY sg.game_num
LIMIT 100
`, seriesID)
if err != nil {
return nil, err