Anvyr Docs
Documentation menu Anvyr Loom 1.x
Anvyr Loom

Version 1.x

← All documentation

GuideAnvyr Loom 1.xOperator

Run a queue worker

Configure a database-backed queue and process background jobs.

On this page

Prepare the queue

Loom supports database and sync queue drivers. The default is database. Configure the application database and apply migrations before starting a worker:

php loom migrate

The default table names are jobs, failed_jobs, and job_batches. A sync driver executes work in the requesting process; a database-backed queue needs a worker.

Start a worker

Run from the application root:

php loom queue:work --queue=default

The worker stays running and processes jobs from that queue. In production, run it under your service manager and arrange for restarts when you deploy application code.

Set resource limits

php loom queue:work --queue=default --sleep=3 --memory=128 --timeout=60 --retry-after=90
Option Meaning
--sleep Seconds to sleep when no jobs are available
--memory Memory limit in MiB
--timeout Job timeout in seconds
--retry-after Seconds before a reserved job can be reclaimed
--max-jobs Exit after processing this many jobs; 0 is unlimited

Keep the job timeout shorter than retry-after so a long-running reservation is not reclaimed while its worker is still processing it. Make jobs safe to retry: external effects can happen before a job fails.

Diagnose an idle worker

Check the active queue driver, database connection, and queue name. Confirm that the application dispatches jobs to the same queue the worker consumes. Read application logs when jobs fail.

Use CLI diagnostics to inspect the environment. Worker defaults are defined in queue configuration.

Continue readingInspect your installation