fix(library): run scans on the stored auto-scan schedule

The auto-scan cron expression was validated, persisted and shown in the UI, but nothing ever
consumed it, so a library configured with a schedule never scanned and no scan job was ever
recorded with the schedule trigger.

Register a cron job per configured library on boot and keep it in step as libraries are created,
updated and deleted. An occurrence that lands while a scan is already running is skipped rather
than retried, and a failing occurrence leaves the job registered so later ones still fire.

Schedules run in the server timezone, matching the cleanup, audit and statistics jobs, so a
deployment that sets TZ gets the wall-clock time its users expect.

Move cron validation into a single shared grammar used by both the API and the schedule editor.
The two sides previously disagreed in both directions: the UI accepted step-zero and reversed
ranges that the API rejected, and rejected day names the API accepted. The grammar is a strict
subset of what the scheduler and the human-readable preview can each parse, so an expression the
editor marks valid can always be scheduled.

Closes #985
This commit is contained in:
neon
2026-08-14 04:46:29 +00:00
parent 34e09fa655
commit 53be54752d
22 changed files with 545 additions and 23 deletions
+1
View File
@@ -76,6 +76,7 @@
"chokidar": "^4.0.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.15.1",
"cron": "^4.4.0",
"date-fns-tz": "^3.2.0",
"drizzle-orm": "^0.45.2",
"fast-xml-parser": "^5.10.1",