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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user