From 91214f9d54fe6c124a5dcee31e6745f6dde7a89c Mon Sep 17 00:00:00 2001 From: Caleb Allen Date: Sun, 29 Mar 2026 12:58:05 -0400 Subject: [PATCH] fix: stop invalidating discography cache after every library scan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- backend/app.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/app.go b/backend/app.go index b650a03..d4befcc 100644 --- a/backend/app.go +++ b/backend/app.go @@ -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() }, })