The task scheduler¶
The scheduler runs the platform's recurring background jobs — the
daily digest, nightly re-indexing, PIM imports, turnover reminders, and
various housekeeping tasks. The scheduler screen (/scheduler) lists these
tasks and their status; each task links to its run history.
How tasks run¶
The runner is an in-process job that fires every minute (it is not an OS cron hitting a URL, and there's no public trigger endpoint). Each minute it selects the site's scheduled tasks and runs any whose scheduled time matches the current minute:
- A task's frequency is daily (runs once at a set time) or hourly (runs each hour at a set minute). There are no cron expressions or arbitrary intervals.
- A task's name is the automation method it runs — the scheduler dispatches by name.
- An app-cache lock (per task, site, and scheduled minute) prevents the same task running twice in the same window across servers.
- Tasks run per-site or globally (site 0). One host is deliberately excluded from running the automation loop.
Each run writes a task log entry with a progress percentage and, on failure, an error message; finishing stamps an end time and marks the task complete. This is the same log the rebate calc issues report reads.
What the scheduler shows¶
- Running now — a live panel above the task list showing every run currently in flight: what it is, when it started, how long it has been running, its progress and latest message, and who triggered it (a named user for runs started from the application, "Scheduler" for timed runs). It refreshes itself every few seconds while the page is open, and the task list below reloads when a run it was showing completes. A run is considered live while it has no end time and has been touched within the last hour; anything silent for longer is treated as abandoned and dropped from the panel, so a thread that died without closing its log row does not look busy forever. A run that reported an error but never finished stays visible, flagged, for that same hour. (Front end 3.8.2 / API 3.8.2.)
- Task list — one row per task: name, recent run count, status, last run, type (scheduled vs manual), a progress bar, and time taken. Only system-owned tasks appear.
- Task detail — the run history for a task: start/end times, progress, info and error messages per run.
Running-task panels elsewhere¶
For superusers, the same "running now" panel is embedded on pages where background work gets started, so they can see a job is already underway and wait for it instead of starting a second one:
- An agreement (deal) page — rebate recalculation, rebate and figures indexing and price analysis for that agreement, plus the site-wide "recalculate / re-index all" runs that will touch it.
- The PIM product list and price comparison pages — PIM imports and indexing, nightly PIM runs and the "analyse prices" background job.
These panels are hidden when nothing relevant is running. For developers:
the panel is the <active-tasks> directive (related-type + related-id
scope it to an entity, task-names to a list of jobs, the two combine as
OR) backed by scheduler.activeTasks; the triggering contact is recorded
on each run's log row when the run is created.
A task can be run manually ("run now") from the screen, which triggers the same dispatch the scheduler uses.
The jobs that run¶
Representative scheduled jobs (the automation methods dispatched by name):
- Digests — daily news digest, financial digest, conference digest, PIM digest, turnover digest.
- Re-indexing — nightly news, contacts, documents, PIM products, turnover; sticky-news refresh.
- Reminders and housekeeping — turnover reminders, product-profile updates, deal-permission repair, rebate-move processing, cache purges, system cleanup.
- Imports/exports — FTP ingest, Sage Intacct import, spend-data export.
Note that rebate calculation is not a scheduled job — it's a one-off task created on demand (when a deal recalculates) that uses the same task log for progress tracking and the calculation log. See the rebate management dashboard.
Creating and editing schedules¶
The scheduler screen is read-and-run only — it lists, shows history, and triggers tasks. There is no UI to create, edit, enable, or delete a scheduled task; the schedule definitions (name, frequency, time) are maintained directly in the database.
Who can use it¶
The scheduler screen and its actions require a logged-in user with the
base view permission; there is no finer role check on listing,
viewing history, or running a task.
Why does a task not run (or run twice)¶
- It didn't fire — its frequency/time didn't match a run minute, it's
a one-off (not
scheduled) task, or the excluded host was the only one up. - It shows "already running" — the per-minute lock was held (a prior run of the same task/site/minute is still in the cache window).
- A run failed — the task log carries the error; check task detail.
What the scheduler is not¶
- Not the event-driven task/to-do system — closing tasks on business events (document approval, invoice paid) is a separate feature that does not run through this scheduler.
- Not a user reminder system — these are system background jobs.
Related pages¶
- Automated task catalog — what each documented scheduled job does
- The rebate aged debt and calc issues reports — reads the rebate-calculation task log
- News posts and the daily digest — a scheduled digest job
- Site settings reference