fix: selective leaderboard cache invalidation instead of full clear (BUG-S10)

Only invalidates __alltime__ and current season cache keys on fight completion,
preserving historical season caches. Test verifies selective behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-13 00:03:16 +00:00
co-authored by Claude Opus 4.6
parent c224776c90
commit 11a76cc249
3 changed files with 113 additions and 4 deletions
+3 -2
View File
@@ -577,8 +577,9 @@ async function executeFightRounds(fightId: string, botA: BotRecord, botB: BotRec
trackMetric(`challenge_${ct}`)
}
// Invalidate leaderboard cache after Elo/stats update
invalidateLeaderboardCache()
// Invalidate leaderboard cache — selective: only alltime + current season
const currentSeason = getCurrentSeason()
invalidateLeaderboardCache(currentSeason?.id)
// Advance tournament bracket if this was a tournament match
try { onTournamentFightFinished(fightId, winnerId ?? null) } catch { /* not a tournament fight */ }