fix: drain scan queue after FullRescan's direct scanInternal call

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.
This commit is contained in:
2026-03-28 10:32:34 -04:00
parent 3c3102aac6
commit acb84660f0
+5
View File
@@ -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