From 4111970996a3f30d75aa2eb5334e1f93970aa39f Mon Sep 17 00:00:00 2001 From: jedarden Date: Thu, 25 Jun 2026 01:13:56 -0400 Subject: [PATCH] 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. --- cmd/acb-index-builder/db.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/acb-index-builder/db.go b/cmd/acb-index-builder/db.go index d377648..de1ae5d 100644 --- a/cmd/acb-index-builder/db.go +++ b/cmd/acb-index-builder/db.go @@ -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