fix: make squad sync opt-in to prevent OOM in scheduled runs

The squads Wikipedia page for 48 teams is very large and was causing the
scheduled sync to be OOM-killed (exit 137) mid-run. Squad data doesn't
change during the tournament, so it doesn't need to run on every sync.
Pass --squads to include it when needed (e.g. initial setup).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-05 09:32:23 +02:00
co-authored by Claude Sonnet 4.6
parent 02d977a866
commit a437affd1d
+3 -1
View File
@@ -204,7 +204,8 @@ async function run() {
goalCount += goals.length goalCount += goals.length
} }
// Squads (fetch once; idempotent upsert so safe to re-run) // Squads — opt-in only (large page, causes OOM in scheduled runs)
if (process.argv.includes('--squads')) {
const squadHtml = await fetchWikiHtml('2026_FIFA_World_Cup_squads') const squadHtml = await fetchWikiHtml('2026_FIFA_World_Cup_squads')
if (squadHtml) { if (squadHtml) {
const squads = scrapeSquads(squadHtml) const squads = scrapeSquads(squadHtml)
@@ -224,6 +225,7 @@ async function run() {
} }
console.log(` Squads: ${squads.length} teams`) console.log(` Squads: ${squads.length} teams`)
} }
}
// Tournament winner (once the final is played) // Tournament winner (once the final is played)
if (meta.winner) { if (meta.winner) {