Skip to content
Docs
Changelog

A cron job is one entry in a table

The cron tick iterates one job table for isolation, the storage gate, the result, the interrupted summary and the log line, so adding a job no longer edits eight places.

Markdown

  • Adding a job is one entry. packages/api/src/platform/jobs/run.ts is now a table: each job states its name, whether it needs storage, its program, the idle summary an interrupted tick reports for it, and what it logs. The tick itself moved to platform/jobs/tick.ts and applies the deadline, the isolation, the storage gate, the result fold and the jobs.tick line to every entry. Before, a new job edited run.ts in seven or eight places. See Scheduled jobs.
  • The tick summary is keyed by job name. pnpm jobs:run prints { interrupted, audits, webhooks, push, ... }. Two shapes changed: the webhook counters moved from the top level to webhooks, and pushQueued/push became push.queued/push.sent. The jobs.tick log line keeps its keys and values (webhooks, pushQueued, push, counts only); only their order follows the table.
  • A job that throws while building its program fails as itself. The tick suspends each entry, so a synchronous throw is that job's failure instead of the tick's.
  • Jobs live in *.jobs.ts. The upload recovery job moved from uploads.service.ts to uploads.jobs.ts and the billing batch from billing.reconcile.ts to billing.jobs.ts. A test now fails when the job table imports a feature by anything but its jobs, config, settings or outbox. See Backend conventions.
  • The tick is tested once. A generic suite runs a fake table through the tick (isolation, a last job, the storage gate, the deadline on the test clock, the three log lines) without mocking a module; the production table's test only pins which jobs it lists and what they log.
Edit on GitHubDocumentation is in English.
Cookie settings
We use essential cookies to make our app work. With your consent, we also use optional cookies to improve your experience.

Read our Cookie Policy and Privacy Policy.