toreador / flarum-job-queue
List, inspect, requeue and auto-requeue failed database queue jobs from the Flarum admin panel.
Package info
github.com/toreador34/flarum-job-queue
Type:flarum-extension
pkg:composer/toreador/flarum-job-queue
Requires
- php: >=7.4
- flarum/core: ^1.2.0
- illuminate/database: ^8.0
- illuminate/support: ^8.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Flarum 1.x admin extension for the flarum/blomstra database queue driver.
It lists failed queue jobs, inspects their payload/exception and explains what
each job does, allows requeueing them (individually or all at once) and can
auto-requeue stale failed jobs via the scheduled task runner — all from the
admin panel.
toreador/flarum-job-queue
Installation
composer require toreador/flarum-job-queue
Then enable the extension:
php flarum extension:enable toreador-flarum-job-queue
php flarum cache:clear
Local path install (development): add a path repository and require it:
"repositories": [{"type": "path", "url": "path/to/flarum-job-queue"}]thencomposer require toreador/flarum-job-queue:*.
If you installed from source, rebuild the admin JS bundle with
cd js && npm run build (the committed js/dist is used by releases).
What it manages
Flarum's blomstra/database-queue driver stores jobs in two tables that are
auto-prefixed with the value from config.php database.prefix
(e.g. sjn4F_):
| Table | Purpose |
|---|---|
{prefix}queue_jobs |
Pending (queued) jobs, processed by the worker |
{prefix}queue_failed_jobs |
Jobs that exhausted their retry count, moved here by the failed-job controller |
This extension reads the live prefix from the active database connection,
so it works out of the box with any prefix. If you ever need to point it at a
different prefix you can override it with the setting
toreador-flarum-job-queue.table_prefix.
Admin page
Open Administration → Queue Manager:
- Stats cards: pending jobs, failed jobs, table names actually in use.
- Toolbar: search, filter by queue, requeue all failed, clear all failed, auto-refresh toggle.
- Table: id, uuid, queue, display name, what the job does, attempts/max tries, failed at and per-row actions (requeue, delete, view).
- The view modal shows the raw
payloadJSON and theexceptiontext so you can see exactly why the job failed. - Requeueing moves the row back into
queue_jobswithattempts=0,reserved_at=NULL,available_at/created_at= now. The originalidis preserved when free; theuuidis preserved when the jobs table has that column.
Auto-requeue (scheduled)
The extension registers a console command and schedules it every minute:
php flarum queue:failed-jobs:requeue # process settings-driven auto-requeue php flarum queue:failed-jobs:requeue 12 42 # requeue specific failed-job ids
Auto-requeue on schedule is enabled with the admin settings:
toreador-flarum-job-queue.auto_requeue— requeue old failed jobs on scheduletoreador-flarum-job-queue.auto_requeue_after(minutes) — only jobs older than this are requeued (default5;0disables the age filter)
The scheduled command requeues nothing when auto_requeue is off. Explicit
queue:failed-jobs:requeue <ids...> always works.
What the requeue does
Equivalent SQL (assuming prefix sjn4F_, replacing :now with
UNIX_TIMESTAMP() on MySQL):
INSERT INTO sjn4F_queue_jobs (uuid, queue, payload, attempts, reserved_at, available_at, created_at) SELECT uuid, queue, payload, 0, NULL, :now, -- available_at = now() :now -- created_at = now() FROM sjn4F_queue_failed_jobs WHERE id = :failedJobId; -- or WHERE 1=1 for "requeue all" DELETE FROM sjn4F_queue_failed_jobs WHERE id = :failedJobId;
Notes (all defensive, this is what the extension actually does):
- Columns are only touched when they exist on the live table. On installs where
the jobs table has no
uuidcolumn that write is omitted and a freshStr::uuid()is used instead. - Preserving the original
idkeeps the job's position: the extension inserts with the original id and lets the database pick a new one if it is taken. - All statements run inside a transaction; if the insert fails the failed row is left untouched.
API endpoints
| Method | Route | Purpose |
|---|---|---|
| GET | /api/queue-manager/jobs |
Stats + start page of failed jobs |
| GET | /api/queue-manager/jobs/:id |
Single job detail (payload + exception) |
| POST | /api/queue-manager/jobs/:id/requeue |
Requeue one failed job |
| POST | /api/queue-manager/jobs/requeue |
Requeue all (optionally ?queue=) |
| DELETE | /api/queue-manager/jobs/:id |
Delete one failed job record |
| POST | /api/queue-manager/jobs/clear |
Delete all (optionally ?queue=) |
Requirements
- PHP 7.4+
- Flarum
^1.2(1.x compatibility first; 2.x support planned) blomstra/database-queue(database queue driver) enabled in Flarum- Flarum scheduler (or cron running
php flarum schedule:run) for the auto-requeue command
About this fork
- Composer package:
toreador/flarum-job-queue - GitHub: https://github.com/toreador34/flarum-job-queue
- Packagist: https://packagist.org/packages/toreador/flarum-job-queue
License
MIT. See LICENSE.