fix(db): add LIMIT to unbounded queries causing OOMKill

- Add LIMIT 10000 to fetchSeasonSnapshots (season_snapshots per season)
- Add LIMIT 500 to fetchChampionshipBracket (series per season bracket)

These queries were called in a loop for each season without LIMITs,
causing acb-index-builder to be OOMKilled with 512Mi memory limit.

Fixes OOMKill after web asset copy in build cycle.
This commit is contained in:
jedarden 2026-06-25 01:13:56 -04:00
parent 0449606ac7
commit 4111970996

View file

@ -645,6 +645,7 @@ func fetchSeasonSnapshots(ctx context.Context, db *sql.DB, seasonID int64) ([]Se
JOIN bots b ON ss.bot_id = b.bot_id
WHERE ss.season_id = $1
ORDER BY ss.rank
LIMIT 10000
`, seasonID)
if err != nil {
return nil, err
@ -679,6 +680,7 @@ func fetchChampionshipBracket(ctx context.Context, db *sql.DB, seasonID int64) (
WHEN 'final' THEN 2
END,
s.bracket_position
LIMIT 500
`, seasonID)
if err != nil {
return nil, err