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.
This commit is contained in:
2026-03-13 09:31:28 -04:00
parent 9272b060bf
commit b36e472212
+6 -2
View File
@@ -480,7 +480,7 @@ func (l *Library) scanInternal(
if batchErr := l.commitBatch( if batchErr := l.commitBatch(
batch, cache, metrics, batch, cache, metrics,
&added, &updated, &added, &updated, &skipped,
thumbChan, thumbChan,
); batchErr != nil { ); batchErr != nil {
errMu.Lock() errMu.Lock()
@@ -843,7 +843,7 @@ func (l *Library) commitBatch(
batch []importResult, batch []importResult,
cache *entityCache, cache *entityCache,
metrics *ScanMetrics, metrics *ScanMetrics,
added, updated *atomic.Int64, added, updated, skipped *atomic.Int64,
thumbChan chan<- thumbnailWork, thumbChan chan<- thumbnailWork,
) error { ) error {
tx, err := l.db.BeginTx() tx, err := l.db.BeginTx()
@@ -886,6 +886,10 @@ func (l *Library) commitBatch(
metrics.addWarning( metrics.addWarning(
result.absolutePath, "commit", saveErr, 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)
} }
} }