Commit Graph
3 Commits
Author SHA1 Message Date
yonlu 5bb1c89fba perf: optimize index build — permanent caches + faster MB rate limit
Three changes to reduce subsequent index build times:

1. Positive image/rels cache TTL: 30 days → 365 days
   Artist url-rels and resolved image URLs rarely change.
   Already-indexed artists make zero API calls on rebuild.

2. Negative cache (misses) stays at 30 days so new images
   are discovered within a month of being added upstream.

3. MB rate limiter for background indexing: 1.0 → 1.5 req/s
   url-rels lookups are lightweight; 1.5/s is well within
   what MB handles (Picard and Kodi both use similar rates).
   Cuts the MB-bound portion of index build by ~33%.

Also adds NewRateLimiterF for fractional rates and caches
MB rels fetch failures (30-day miss TTL) to avoid retrying
unreachable artists every build.
2026-03-29 12:00:36 -04:00
yonlu bba4e1f3de feat: SearchIndex — background build + FTS5 query for popularity index
New SearchIndex struct in searchindex.go:
- Background build fetches top 1000 LB artists, then their top 10
  release groups and top 10 recordings (2001 API calls total)
- Dedicated 3 req/s rate limiter for indexer (LB allows 30/10s)
- Bounded concurrency (3 goroutines) with progress logging
- Batch INSERTs in transactions of 100 rows
- FTS5 query with prefix matching ('for you' → 'for* you*')
- Results sorted by popularity descending
- Skips rebuild if index is < 7 days old
- Marks index ready from existing rows if build fails
- Context cancellation for clean shutdown
2026-03-25 09:39:22 -04:00
yonlu 8fc075c24a perf(S01/T01): Add token-bucket rate limiter (1 req/sec), SQLite respon…
- backend/explore/ratelimiter.go
- backend/explore/cache.go
- backend/database/sql/schemas/explore_cache.sql
- backend/database/database.go
2026-03-23 07:55:25 -04:00