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:
@@ -578,7 +578,9 @@ func TestResolveDuplicates_AgreeingLookupsDecideAnAcousticGroup_Integration(t *t
|
||||
|
||||
// A pass while a scan is walking the library waits for it: a copy removed
|
||||
// under the walk is marked present again when the scan reconciles. A run
|
||||
// stuck past StuckScanThreshold does not hold the resolver up.
|
||||
// stuck past StuckScanThreshold does not hold the resolver up. Files being
|
||||
// read with no run recorded (a scan whose run row hasn't landed yet, a
|
||||
// watcher batch) hold it up as well.
|
||||
func TestDuplicateResolveWorker_WaitsForARunningScan_Integration(t *testing.T) {
|
||||
f := seedTrimmedAlbum(t)
|
||||
ctx := context.Background()
|
||||
@@ -598,6 +600,21 @@ func TestDuplicateResolveWorker_WaitsForARunningScan_Integration(t *testing.T) {
|
||||
if w.tickOnce(ctx) {
|
||||
t.Error("a scan stuck for two hours held the resolver up")
|
||||
}
|
||||
|
||||
if _, err := f.pool.Exec(ctx, `DELETE FROM scan_runs`); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !filesGate.tryAcquire() {
|
||||
t.Fatal("the files gate was already held")
|
||||
}
|
||||
waited := w.tickOnce(ctx)
|
||||
filesGate.release()
|
||||
if !waited {
|
||||
t.Error("a pass ran while files were being read, with no scan run recorded")
|
||||
}
|
||||
if w.tickOnce(ctx) {
|
||||
t.Error("a pass was put off with nothing reading files")
|
||||
}
|
||||
}
|
||||
|
||||
// AcoustID knows the recording as no song of the album: every copy goes. With
|
||||
|
||||
Reference in New Issue
Block a user