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:
parent
18db52a47c
commit
ee39633ad7
6 changed files with 60 additions and 8 deletions
|
|
@ -88,6 +88,14 @@ pacing).
|
|||
- `state.jsonl` = append-only completed `{file_id,preset_key,format}` → resume.
|
||||
- All state is **file-backed** (PM2 cluster, 8 workers — never in-memory).
|
||||
|
||||
## Nightly scheduling
|
||||
|
||||
- The hook registers `schedule('*/15 * * * *')` — **in-process**, no external cron/token. Every tick it
|
||||
checks enabled + maintenance window + no active run, then starts/resumes the backfill.
|
||||
- The backfill **pauses** when the window closes (`run.paused = true`) and resumes next night.
|
||||
- `scheduleSynchronizedJob` makes the cron cluster-safe; the `run.lock` file is a second guard.
|
||||
- `Run now` in the admin module ignores the window (`ignoreWindow: true`).
|
||||
|
||||
## Gotchas learned the hard way
|
||||
|
||||
- **Directus coerces env values**: `"true"` arrives as boolean `true`, `"1"` as number. Env parsing must
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue