mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
Master landed #4274 with the review changes that came out of it, and those moved the code this branch was built on. Scan job bookkeeping now lives in `handler/scan_jobs.py`, every enqueue goes through `enqueue_task`, cron entries carry their own name and result TTL, and the watcher builds its two rescans from one helper. Resolved by putting this branch's changes where that code now lives: - The scan queue, the scoped-scan check and the second scheduled registry moved into `handler/scan_jobs.py`, keeping master's single-round-trip reads (`get_job_ids` plus one `fetch_many`, and `get_jobs_to_schedule` for the stale sweep) across both registries. - `enqueue_scheduled_scan` sits next to `enqueue_task` in the registry and is built from it, rather than hand-rolling the same enqueue in `tasks/tasks.py`. Its tests moved with it. - Cron keeps master's per-entry name and result TTL, and adds the scan dispatch on top: `TASK_TIMEOUT` for the dispatch, the task's own timeout (now `SCAN_TIMEOUT`) for the scan it enqueues. - The watcher's `schedule_rescan` helper enqueues on the scan queue with the abandoned-job callback. - `PeriodicTask.func` is gone from master, so the scheduled rescan declares only its timeout. `tasks.registry.enqueue_scheduled_scan` joins the func paths an RQ worker has to be able to import. - The job stubs shared by the discovery tests grew the scan queue and a scoped-scan job; the duplicated stale-sweep tests are master's. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>