nails / module-queue
There is no license information available for the latest version (0.0.1) of this package.
0.0.1
2025-11-07 17:13 UTC
Requires
- php: ^8.2
- nails/common: dev-develop
- nails/module-console: dev-develop
- nails/module-cron: dev-develop
Requires (Dev)
- nails/module-admin: dev-develop
- phpstan/phpstan: 2.*
- phpunit/phpunit: 10.*
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-02 20:58:55 UTC
README
A lightweight, database-backed job queue for Nails. Push a task with a payload, run it in a long-lived worker, and retry it with exponential backoff when it fails.
- Storage: MySQL tables managed by migrations (
nails_queue_job,nails_queue_worker) - Concurrency: jobs are reserved with
SELECT ... FOR UPDATE SKIP LOCKED, so MySQL 8.0+ or MariaDB 10.6+ is required - Ordering: first in, first out by job
idamong jobs that are due - Retries: per-task maximum, backoff from 5 seconds doubling to a 5 minute cap, with 20% jitter
- Admin: an overview screen and a dashboard warning when a queue has no live worker
Console commands:
queue:workruns a worker. Repeat--queueto work several queues. It defaults todefault.queue:run <job>runs one job's task in the current process, without changing the jobqueue:cleanremoves dead workers, resets stuck jobs, and deletes old jobs. Cron runs it every 5 minutes.
Install with Composer, then migrate:
composer require nails/module-queue nails db:migrate
A worker must be running for anything to happen, and it should be kept alive by a process manager such as systemd or Supervisor. default and priority are separate queues with no special treatment: the app has to run a separate worker for priority.
See the documentation for writing tasks, defining queues, configuration, running workers under systemd or Supervisor, and the admin screen.