fix: stop invalidating discography cache after every library scan

Root cause: OnAllScansComplete called InvalidateIndexDiscographies()
which deleted the discog_built timestamp. SoftScanAllLibraries
triggers a scan whenever file counts differ (even by 1 file), so
on most launches the hook fired and wiped the cache.

The invalidation was unnecessary — Tiers 2-4 are already incremental.
filterUnindexed skips artists that are already indexed, so new
library artists with freshly-populated MBIDs get picked up naturally
without forcing a full rebuild.

InvalidateIndexDiscographies is kept as a public API for manual
rebuild (future UI button) but no longer called automatically.

Combined with per-tier timestamps from the previous commit, the
index build now correctly skips completed tiers on restart.
This commit is contained in:
2026-03-29 12:58:05 -04:00
parent e6692e9f1b
commit 91214f9d54
+6 -3
View File
@@ -232,9 +232,12 @@ func (yj *YellowJacketApp) OnStartup(ctx context.Context) {
yj.library.SetScanHooks(library.ScanHooks{
ResolvePhantoms: yj.playlist.ResolvePhantomTracksAfterScan,
OnAllScansComplete: func() {
// Force index Tiers 2-4 to re-check for new library
// artists whose MBIDs were just populated by the scan.
yj.explore.InvalidateIndexDiscographies()
// 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()
},
})