Skip to content

Graphile Worker

Graphile Worker puts jobs in PostgreSQL and runs their code in a Node.js worker you operate. A pending job can be replaced using a job key.

Visit Graphile Worker

Can several edits share one waiting job?

Yes. With the default replace mode, a matching unlocked job can be updated by its key. A job already running can be followed by a second job. Use a key that identifies the job’s purpose and record, and check which revision your app is publishing.

For a latest-version preview, store the record ID and revision in an object. Graphile Worker can merge two arrays instead of replacing them, which is useful for batching but is a different job.

Where can you see whether a job failed or finished?

A task that reports an error can retry with increasing delays. Inspect attempts or last error in the documented jobs view. Successful jobs are deleted, so keep a result such as Preview for revision 3 in your own app. A job key is not a permanent record of prior work.

What do you run and what should you keep?

The open-source Worker uses the MIT license. Run a Node.js worker with access to a compatible PostgreSQL database. Budget for both, plus job storage and support if needed. Save the task code and key, retry and scheduling rules so you can rebuild the queue.

Keep any important results separately. When changing versions or moving, use the documented view to inspect pending work instead of building around private job tables.

What happens if a listing changes while its preview is being rebuilt?

Use paper cards for a fictional listing and its preview. No database or real listing is involved.

  1. Replace one waiting card
    Draw revision 2 arriving while revision 1 waits under the same key. Keep the revision 2 card as the pending job.
  2. Add an edit while it runs
    Start building revision 2, then pause just before saving its preview. Add revision 3 and draw the second job. Label each preview with the revision it came from so it has its own place to be saved.
  3. Check the visible result
    Save preview 3 first, then let the delayed job save preview 2 under its own revision. The listing is now at revision 3, so show only preview 3. If preview 3 is missing, show that it is still being built.