Repository navigation
Releases: contenir/contenir-queue
Releases · contenir/contenir-queue
Release list
v0.1.1
v0.1.0
Added
- Durable jobs in a
queue_jobtable on MySQL or SQLite, created by a peptolab/phpdb-migration migration in
schema/: job class, payload, queue, state (waiting, running, done, failed), attempts, next attempt, lock and last
error. QueueInterface::push()to store a job, now or for later, on a named queue.JobHandlerInterfacefor handlers, resolved from a PSR-11 container by the job's class.JobRunner, which runs a claimed job and records the result. Failures retry withBackoff(1 minute doubling to
24 hours, then failed).RetryLaterExceptionsets the next attempt, including from an HTTPRetry-After, and
UnrecoverableJobExceptionfails a job at once, as does a handler missing from the container.PhpDbJobStore, which claims jobs atomically so several workers and web requests can share the table, and only
finishes a job while it still holds the lock it was claimed with.bin/contenir-queue, the worker cron runs every minute. It takes a lock in aqueue_workertable so only one runs,
renews it as a heartbeat, and runs due jobs until nothing is due or 50 seconds (configurable) have passed.
--daemonruns it with no time limit, waiting for work, until SIGTERM, its memory limit or a job limit, for a
process supervisor.Worker, which the command runs. Before taking jobs it retries jobs whose worker died mid-run (locked for over an
hour) and deletes done jobs older than seven days.Drainer::drain(), for a host to call after the response has been sent: it runs up to three due jobs within two
seconds, unless the worker's heartbeat is under two minutes old.- Schedules:
Schedulewith aFrequency(everyMinutes(), orcron()in a time zone, read by the package's own
standard five-field cron parser), added to theSchedulesservice or configured undercontenir_queue.schedules.
Scheduler::tick(), run by the worker on every turn and by the drain, pushes the job of each schedule that has
fallen due. A run whose last job is still waiting or running is skipped. Each run is recorded in
queue_schedule_run, and the schedule's state is kept inqueue_schedule. QueueMonitor, the data for a host's screens and checks: job counts, jobs by state, retry and delete, schedules
with their last and next runs, a schedule's recent runs, andQueueHealthwith the heartbeat's age, what is
waiting and what has failed.ConfigProviderand PSR-11 factories, configured undercontenir_queue.- Mago, PHPUnit unit and integration suites (SQLite, and MySQL in CI), Infection (MSI 100%) and Codecov in CI.