From acb84660f091e76e1fa35dd003edc6b0605d015b Mon Sep 17 00:00:00 2001 From: Caleb Allen Date: Sat, 28 Mar 2026 10:32:34 -0400 Subject: [PATCH] fix: drain scan queue after FullRescan's direct scanInternal call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FullRescan calls scanInternal directly (not via startScan) to get ScanMetrics back. But startScan is what calls drainQueue when it finishes. Without drainQueue, any libraries queued via ScanLibrary sat in the queue forever — scanActive remained true, the queued library never scanned. Fix: call drainQueue in a goroutine after queuing the remaining libraries. This processes the queue sequentially and eventually sets scanActive=false + fires OnAllScansComplete. --- backend/library/rescan.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/library/rescan.go b/backend/library/rescan.go index a31ff92..f538e08 100644 --- a/backend/library/rescan.go +++ b/backend/library/rescan.go @@ -80,6 +80,11 @@ func (l *Library) FullRescan() (*ScanMetrics, error) { } } + // Drain the queue in a goroutine so any queued libraries + // scan sequentially. scanInternal was called directly (not + // via startScan), so drainQueue hasn't been invoked yet. + go l.drainQueue() + if metrics != nil { metrics.ClearQueue = clearQueueDur metrics.ClearDatabase = clearDBDur