perf: lightweight post-scan indexing — only index new artists

After a library scan completes, OnAllScansComplete now calls
IndexNewArtists() instead of StartIndexBuild(). This skips the
full tier pipeline (sitewide top artists, similar artists, freshness
checks) and only indexes library artists whose MBIDs are not yet
in the search index.

Flow after scan:
1. Query indexed artist MBIDs (fast, in-memory set)
2. Query library artist MBIDs
3. Diff → only new artists
4. Fetch discographies + images for new artists only

The full StartIndexBuild() still runs on initial launch (when
SoftScanAllLibraries finds no work to do) to handle the tier
pipeline with freshness-based refresh. But adding 5 new albums
to your library no longer triggers a 60-minute index rebuild.
This commit is contained in:
2026-03-29 13:04:21 -04:00
parent 91214f9d54
commit d47270e0b8
3 changed files with 106 additions and 7 deletions
+3 -7
View File
@@ -232,13 +232,9 @@ func (yj *YellowJacketApp) OnStartup(ctx context.Context) {
yj.library.SetScanHooks(library.ScanHooks{
ResolvePhantoms: yj.playlist.ResolvePhantomTracksAfterScan,
OnAllScansComplete: func() {
// Start the index build after scans finish.
// Tiers 2-4 are incremental — filterUnindexed
// already skips artists that are already indexed,
// so new library artists with freshly-populated
// MBIDs get picked up without invalidating the
// entire discography cache.
yj.explore.StartIndexBuild()
// Only index artists that are new since the last
// build — don't re-run the full tier pipeline.
yj.explore.IndexNewArtists()
},
})