8bbc1db32f
Two worker-loop robustness fixes: - Scan chunking: maybe_run_scan advances the library scan by at most one scan_chunk (default scan.chunkSize=25 albums) per loop iteration, so a large library no longer blocks job-claim/monitor for minutes-to-hours. Progress persists in scan.inProgress/scan.cursor/scan.progress and is resumable; scan.result (unchanged format) is written on completion. - DB reconnect: wrap the loop body in `except psycopg.OperationalError` (AdminShutdown subclasses it) to close the dead handle and reconnect via wait_for_db() in-process, instead of crashing and relying on the container restart policy. Verified via a backend-termination test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>