The scheduler: templates, instances, self-healing and permissions
Data model of the single scheduler, the relation of template and instance rows, the supported job types, the rules for saving and row actions, self-healing and the content scope.
The system has a single scheduler. The template rows of the queue (is_template = 1) define WHEN for a company, a company group or the system; the catalog worker (masterdata/cronqueue.run) inserts instance rows (is_template = 0) from due templates and processes them. Timing is calculated by the shared schedule calculator (minute, hour, day, week, month; Europe/Budapest).
Data model
Table names carry the installation's own prefix in the database.
| Table | Role | Main fields |
|---|---|---|
cron_queue | templates and instances | job_type, company_id, company group, is_template, next_run, status, payload (e.g. email_task_id, check_code) |
cron_health | open self-healing findings | job type, issue, state |
company | target company | read only |
Saving and row actions
- Job types on the form:
taxaccount,missingtaxreturn,email,email_commands,email_ai,taskdigest,taskrecurring,nav_invoice_query,nav_invoice_sync,nav_invoice_data,email_task,integrity_check,content_translate. - Target: company, company group, or for system jobs (
email*,taskdigest,integrity_check) the system. Parameterised jobs:email_task(company and timing come from the task),integrity_check(the check code). - Optional result e-mail (
mail_notify0–2, channel and template from the mail module per client). - After saving: next run calculated, row read back, mail setting saved. For an instance row only
next_runcan change. runnow: immediate instance row(s), one per member company for a group; the template'snext_runis unchanged.stopselected: template → deactivate, instance → delete.delete: physical delete, the mail module setting is deactivated.- Every action writes to the
cronlog channel. enqueueDue(): public method of the runner bridge; inserts rows from due templates and advancesnext_run; permission:edit.
Self-healing
The health endpoint runs what the worker runs every 10 minutes: restores broken self-sustaining chains, resets rows running for more than 60 minutes, fixes drifted e-mail task schedules, cleans orphaned templates and rows of deleted companies. It reports rows dead after 3 attempts, items waiting more than 6 hours and unknown job types. Reply: number of repaired and open items. The service library writes its own SQL. Missing table: error_health_schema.
Errors
error_job_type, error_target, error_object, error_object_no_company, error_duplicate_template, error_mail_template, error_save_not_created, error_next_run.
Permissions
| Key | Class | Endpoints |
|---|---|---|
list | unclassified | list, company picker |
add | no catalogue row, so edit decides | save as new (canSave) |
edit | not in the seeds | form, runnow, enable, disable, mail options |
delete | not in the seeds | delete; stop and stopselected with delete or edit |
statusdelete | BASE | in the seed but without an endpoint; behaviour cannot be determined |
health | permission input only | self-healing |
debug | not in the seeds | list SQL |
Content scope: the list filters by filter_allowed_ids; write endpoints by idsInScope and scheduleInScope; system-level rows cannot be managed by anyone but the super administrator.