Workhorse
Producing work

Priority

Run urgent ready jobs before ordinary work while preserving FIFO order among peers.

Set EnqueueOptions.priority when jobs in one queue should not all compete at the same rank. PostgreSQL claims higher values first, then keeps FIFO order among jobs with the same value.

await queue.enqueue("invoice.remind", { invoiceId }, { queue: "billing", priority: 10 });

Priority is strict. A steady stream of urgent jobs can delay lower-priority work because Workhorse does not age jobs or reserve capacity between priority classes. Put work that must always progress on a separate queue with its own capacity.

Priority follows the job

Retries, durable waits, delays, and manual promotion keep the stored priority because they continue the same job. Redrive creates a fresh job but copies the source priority, so urgent failed work does not silently become ordinary work.

Schedule definitions accept priority on their job definition. Priority orders only work that is otherwise admissible; it does not bypass queue pauses, concurrency policies, rate limits, or a future runAt.

The dashboard sorts the task list with higher priority first and shows the stored value in task details. The System page groups ready work by priority and shows the oldest task in each group, so operators can see lower-priority work waiting behind urgent arrivals.

In TypeScript, ScheduleJobDefinition stores the recurring job's priority before fireSchedule creates an occurrence, so scheduled work enters the ordinary priority order.

Next


Exact priority bounds and dispatch rules: architecture reference.