From b36e472212957ff089f4f5d35f3978a754e23502 Mon Sep 17 00:00:00 2001 From: Caleb Allen Date: Fri, 13 Mar 2026 09:31:28 -0400 Subject: [PATCH] fix(12-02): count failed saves as skipped so scan progress bar advances Files that fail to save (e.g. UNIQUE constraint from pre-existing tracks with a different library_id) were not counted in any progress counter, leaving the progress bar stuck at 0%. Now increments skipped so processed = added + skipped + updated reflects all files visited. --- backend/library/library.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/library/library.go b/backend/library/library.go index 10b22ba..445c84b 100644 --- a/backend/library/library.go +++ b/backend/library/library.go @@ -480,7 +480,7 @@ func (l *Library) scanInternal( if batchErr := l.commitBatch( batch, cache, metrics, - &added, &updated, + &added, &updated, &skipped, thumbChan, ); batchErr != nil { errMu.Lock() @@ -843,7 +843,7 @@ func (l *Library) commitBatch( batch []importResult, cache *entityCache, metrics *ScanMetrics, - added, updated *atomic.Int64, + added, updated, skipped *atomic.Int64, thumbChan chan<- thumbnailWork, ) error { tx, err := l.db.BeginTx() @@ -886,6 +886,10 @@ func (l *Library) commitBatch( metrics.addWarning( result.absolutePath, "commit", saveErr, ) + + // Count failed saves as skipped so the progress bar + // advances (e.g. UNIQUE constraint from pre-existing tracks). + skipped.Add(1) } }