On this page
Level: C4 L3, components of the worker container. Read this if you are an engineer adding a job, tuning a queue or deciding how workers are split across processes.
Up/Down: up: L2 Containers. Siblings: Web app components. Domain flow of the data these jobs move: Ingest pipeline.
In short#
One worker image runs BullMQ consumers over Redis. A WORKER_POOL setting picks which queue groups a process starts; by default one process starts all of them. Producers write durable intent to a Postgres outbox, a dispatcher publishes it, and one wrapper classifies every failure.
Components#
| Component | Where | Owns |
|---|---|---|
| Queue definitions | apps/ |
Queue names (a stable contract: renaming orphans in-flight jobs), Zod payload schemas, retry options |
| Pools | apps/, index. |
sync, ai, alerts, materialize, scheduled, archive, all; each worker registration is tagged with one |
| Outbox dispatcher | apps/ |
Claims committed outbox rows with FOR UPDATE SKIP LOCKED, publishes with a stable job id, marks them |
| Schedulers | apps/, playbook- |
Cron-style jobs upserted by stable id at boot, patterns pinned to Vietnam time |
| Processors | apps/ |
One file per job family: connector sync (marketplace, marketing, dataset), webhooks, AI, alerts, notify delivery, rollups, backups |
| Failure wrapper | job-, job- |
One classification for every worker: permanent, transient or parked |
| Watchdog | apps/ |
A separate process from the same image; evaluates alarms over web and worker metrics |
Pools#
| Pool | Runs |
|---|---|
sync |
Per-marketplace, marketing and file sync queues, marketplace webhooks, OAuth token refresh |
ai |
Model-bound jobs |
alerts |
Alert evaluation, notification delivery, briefings, audience refresh |
materialize |
Gold rollups, action memos, playbook runs, manual uploads, dashboard subscriptions, dataset and validation jobs |
scheduled |
The cron dispatcher, the outbox dispatcher and the minute sweep that delivers platform webhooks |
archive |
Organization backup and restore, under its own database identity |
Rollup rebuilds of one organization are serialized by a transaction-scoped Postgres advisory lock (packages/metrics/src/rollup-lock.ts), so two worker processes cannot interleave a rebuild. The scheduled pool should still run in exactly one process: scheduler upserts are idempotent, but the outbox dispatcher and sweeps are cheaper to reason about with one owner.
Durable handoff and failure handling#
A web change that needs async work writes an outbox row in the same transaction, so the change and the intent commit or roll back together. The dispatcher publishes after commit; the job id makes a crash between publish and mark replay-safe.
| Failure | Class | Effect |
|---|---|---|
| Unprocessable payload, authentication, decrypt or template error, constraint violation, client error other than timeout or rate limit | Permanent | One dead-letter row; retries stop |
| Vendor rate limit | Parked | The connector cools down and shows as degraded; no alert |
| Anything else | Transient | Retry with exponential backoff and jitter (sync queues: 5 attempts from 30 s) |
Connector sync, step by step#
The same flow, with the tables and guarantees at each step, is in Ingest pipeline.
Alert delivery#
The alerts pool evaluates rules over Gold, writes incidents and enqueues notification jobs. A message leaves only when platform, organization and person all allow the channel; the in-app inbox needs no transport. Transport failures use the same permanent, transient and unsubscribe classes. See Notifications.
Where it stops#
Pool splitting is supported by the code and by an optional compose overlay, but the overlay is not the default deployment; see Deployment. Readiness per capability: Project status.