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