Repository navigation
Done
Labels
backendBackend/Python/FastAPIbugSomething isn't workinghigh-priorityHigh priorityreliabilityReliability/resilience
Description
Summary
A bulk "Scan now" (library, show, several titles) force-scans every title, and forced scans ignore both the scan window and a manual pause, so a big batch runs straight through the end of the window and nothing stops it short of restarting the app.
Evidence
- cleanplex/web/routes/scanner_routes.py:302 — library Scan now calls
force_scan_jobfor every chosen title - cleanplex/web/routes/scanner_routes.py:151 —
_queue_rescan(now=True)(titles, show) does the same - cleanplex/scanner.py:1101 — a running forced scan ignores
_paused; :1109 it also ignores the window end - cleanplex/scanner.py:1210 — outside the window, workers still claim force jobs; :1230 claiming any job calls
resume_scanner(), soPOST /api/scan/pauseis undone by the next claim - Prod 2026-12-04: 234 titles force-queued at 17:54 kept scanning after the window closed at 18:00 (
force_scan=True, in_window=False)
Impact
Scanning (CPU-heavy) runs for hours outside the hours the user set, and there is no way to stop it for a while.
Proposed Work
- Split the force flag: 2 = single-title Scan now (may run outside the window, as Stop idle worker pausing abort another worker's forced scan #201 decided), 1 = bulk Scan now (jumps the queue, obeys the window)
- A persisted pause with an optional end time (
scan_paused_untilsetting):POST /api/scan/pause {"until": "01:00"}; while it holds no job is claimed and running scans, forced ones included, are re-queued - Status endpoints report
paused_until
Acceptance Criteria
- A bulk Scan now outside the window queues titles first in line but none starts until the window opens; a running one stops at the window end
- A single-title Scan now still starts outside the window
- While a manual pause holds, no scan (forced or not) is claimed and a running forced scan is re-queued
- The pause survives a restart and lifts itself at its end time
Metadata
Metadata
Assignees
Labels
backendBackend/Python/FastAPIbugSomething isn't workinghigh-priorityHigh priorityreliabilityReliability/resilience
Activity
fix: make bulk Scan now obey the scan window and manual pause
nazmolla commentedon Dec 5, 2026
Resolution
Status: Fixed
What was done
FORCE_NOW(one title, may run outside the window) andFORCE_QUEUED(bulk, waits for the window) — cleanplex/database.py,claim_next_scan_job(force_only=True)claims onlyFORCE_NOWFORCE_QUEUED— cleanplex/web/routes/scanner_routes.py_now_levelscan_paused_until) that stops every scan, forced ones included, and lifts itself — cleanplex/scanner.pyset_hold/load_hold/hold_active;POST /api/scan/pause {"until": "HH:MM"}How to verify
pytest tests/unit/test_scanner_generators.py tests/integration/test_routes_scanner.py tests/unit/test_database.py(bulk forced scan waits outside the window and stops at its end; pause stops a single-title forced scan; force_only skips bulk jobs; pause persists and expires)manual_pause: true, no scans running at 19:xxRelated