fix(library): a scan and a duplicate-resolver pass never touch the files at once (#8197)
release / go (push) Successful in 2m17s
release / web (push) Successful in 1m29s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m28s
release / android (push) Successful in 4m25s
release / Build signed APK (push) Successful in 5m8s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 15s
release / Verify release artifacts (tag releases only) (push) Skipped
release / go (push) Successful in 2m17s
release / web (push) Successful in 1m29s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m28s
release / android (push) Successful in 4m25s
release / Build signed APK (push) Successful in 5m8s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 15s
release / Verify release artifacts (tag releases only) (push) Skipped
The resolver checked for a running scan once, at the start of a pass. At boot that check could run before the startup scan recorded its run, and a scan that began mid-pass was never seen, so the pass removed copies the scan had listed (23 "no such file" errors on dev, 2026-11-28). A gate now keeps the two apart for their whole length: a full scan and each watcher batch hold it, a scan that meets a pass waits for it (up to 30 minutes, then gives up with a named error), and a pass that meets a scan is put off and tried again a minute later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -146,6 +146,10 @@ func New(pool *pgxpool.Pool, logger *slog.Logger, paths []string, settings *Fing
|
||||
// processed file. Used by the orchestrator to drive partial-tally writes.
|
||||
func (s *Scanner) Scan(ctx context.Context, progressCb func(Stats)) (Stats, error) {
|
||||
var stats Stats
|
||||
if err := filesGate.acquire(ctx, filesWaitLimit); err != nil {
|
||||
return stats, fmt.Errorf("library scan: %w", err)
|
||||
}
|
||||
defer filesGate.release()
|
||||
q := dbq.New(s.pool)
|
||||
start := time.Now()
|
||||
|
||||
@@ -564,6 +568,10 @@ func (s *Scanner) scanFile(
|
||||
// album IDs whose tracks were added or updated, so the caller can enrich
|
||||
// just those albums inline rather than waiting for a batch pass.
|
||||
func (s *Scanner) ScanFiles(ctx context.Context, paths []string) ([]pgtype.UUID, error) {
|
||||
if err := filesGate.acquire(ctx, filesWaitLimit); err != nil {
|
||||
return nil, fmt.Errorf("library watch: %w", err)
|
||||
}
|
||||
defer filesGate.release()
|
||||
q := dbq.New(s.pool)
|
||||
seen := make(map[[16]byte]struct{})
|
||||
changed := make([]pgtype.UUID, 0)
|
||||
|
||||
Reference in New Issue
Block a user