fix: replace TTS FIFO cache with LRU eviction, add database indexes
TTS audioCache now tracks lastAccess timestamp per entry and evicts the least-recently-used entry when full (was FIFO, deleting commonly used phrases). Adds 6 new database indexes for bets, bot type/active filtering, payment status lookups, and tournament entries. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
fbc61ef154
commit
46d560af24
@@ -182,6 +182,12 @@ export function runMigrations() {
|
||||
CREATE INDEX IF NOT EXISTS idx_payments_status ON payments(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_payments_bot ON payments(bot_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_tournament_matches_tournament ON tournament_matches(tournament_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_bets_fight ON bets(fight_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_bets_bettor ON bets(bettor_pubkey, created_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_bots_type_active ON bots(bot_type, is_active);
|
||||
CREATE INDEX IF NOT EXISTS idx_payments_status_created ON payments(status, created_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_tournament_entries_tournament ON tournament_entries(tournament_id);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_analytics_date_metric ON analytics(date, metric);
|
||||
`)
|
||||
|
||||
// Run PRAGMA optimize on startup for query planner stats
|
||||
|
||||
Reference in New Issue
Block a user