feat: in-process nightly scheduler + pause at window end

Hook registers a 15-minute schedule that starts/resumes the backfill only
inside the maintenance window (no external cron or token). The backfill
pauses when the window closes and resumes next night. UI shows paused
state and last-run errors.
This commit is contained in:
Rawman Grey 2026-10-25 14:26:49 +03:00
parent 18db52a47c
commit ee39633ad7
6 changed files with 60 additions and 8 deletions

View file

@ -110,12 +110,12 @@ The admin module includes a full API reference with curl examples.
## Scheduling
Scheduled runs are window-bound; an external cron can trigger them:
The extension schedules itself **inside Directus** — no external cron, no token:
```bash
0 * * * * curl -fsS -X POST http://localhost:8055/image-previews/run \
-H 'Authorization: Bearer <admin-token>' -H 'Content-Type: application/json' -d '{}'
```
- every 15 minutes it checks whether it is inside the maintenance window;
- if enabled, inside the window, and no run is active, it starts/resumes the backfill;
- the backfill **pauses when the window closes** and resumes the next night (it is resumable);
- once all tasks are done, it stays idle until the next day.
`Run now` in the admin module ignores the window.