fix(db): add LIMITs to unbounded queries in fetchEvolutionMeta and fetchLineage
- Add LIMIT 100 to island populations query (fetchEvolutionMeta) - Add LIMIT 10000 to lineage programs query (fetchLineage) These queries had no row limits, causing OOMKill when the programs table grew large. The pod crashed silently after "Copied web assets" because Go panics and OOMKills exit without logging to slog. Fixes acb-index-builder CrashLoopBackOff (4700+ restarts, 45 days).
This commit is contained in:
parent
80c39a3f2a
commit
bbe5f45ac1
1 changed files with 2 additions and 1 deletions
|
|
@ -1111,7 +1111,7 @@ func fetchEvolutionMeta(ctx context.Context, db *sql.DB) (*EvolutionMeta, error)
|
|||
// Fetch island populations
|
||||
meta.IslandPopulations = make(map[string]int)
|
||||
islandRows, err := db.QueryContext(ctx, `
|
||||
SELECT island, COUNT(*) FROM programs GROUP BY island
|
||||
SELECT island, COUNT(*) FROM programs GROUP BY island LIMIT 100
|
||||
`)
|
||||
if err == nil {
|
||||
for islandRows.Next() {
|
||||
|
|
@ -1182,6 +1182,7 @@ func fetchLineage(ctx context.Context, db *sql.DB) ([]LineageNode, error) {
|
|||
SELECT id, parent_ids, generation, island, fitness, promoted, language, created_at
|
||||
FROM programs
|
||||
ORDER BY generation ASC, id ASC
|
||||
LIMIT 10000
|
||||
`
|
||||
|
||||
rows, err := db.QueryContext(ctx, query)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue