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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user