Core DevPre-alpha
Multi-instance cron
When you run more than one Sumeru process against the same database, each process starts the built-in scheduler (scheduler.Start in core/server/run.go).
Safe concurrent execution
Due cron rows are selected inside a transaction with:
SELECT … FROM sys_cron
WHERE active AND (next_call IS NULL OR next_call <= $now)
ORDER BY id
FOR UPDATE SKIP LOCKED
LIMIT 20
Only one instance locks a given row; others skip locked rows. After the handler runs, next_call and last_call are updated in the same transaction.
Operational guidelines
- Keep clock sync — use NTP on all app hosts; cron uses UTC.
- Do not mix different Sumeru versions on the same database during cron-heavy windows.
- Long handlers — if a cron handler exceeds the tick interval, the next window picks up where scheduling left off; avoid blocking handlers longer than a few seconds.
- Outbox drain — each replica also runs
StartOutboxDrain; rows are drained once viapublished_at IS NULLupdates (idempotent publish).
For heavy cron load, prefer dedicated worker processes with -stop-after-init module ops disabled and HTTP disabled (future sumeru worker CLI), or external queue consumers fed by the outbox queue topic.