fix(library): a scan cut off by a restart no longer blocks saving library folders
A restart mid-scan left its scan_runs row unfinished, and saving library
folders refused ("A library scan is running") until a later scan reaped it,
up to 12 hours on. Startup now closes such rows with the reason before the
boot scan, as backups already do. Saving folders and the duplicate sweep
share one check that treats a run past StuckScanThreshold as dead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,15 @@ UPDATE scan_runs
|
||||
SET artist_art_enrich = $2
|
||||
WHERE id = $1;
|
||||
|
||||
-- name: FailUnfinishedScanRuns :execrows
|
||||
-- At startup no scan can be running yet, so a row still unfinished was cut
|
||||
-- off when the server last stopped. Closing it keeps it from reading as a
|
||||
-- scan in progress, which would block saving library folders.
|
||||
UPDATE scan_runs
|
||||
SET finished_at = now(),
|
||||
error_message = 'The server stopped while the scan was running.'
|
||||
WHERE finished_at IS NULL;
|
||||
|
||||
-- name: GetInFlightScanRun :one
|
||||
-- Used by POST /api/admin/scan/run to 409 when a scan is already running.
|
||||
-- "In flight" = finished_at IS NULL.
|
||||
|
||||
Reference in New Issue
Block a user