Download the PHP package honchoagency/craft-queue-bouncer without Composer
On this page you can find all versions of the php package honchoagency/craft-queue-bouncer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download honchoagency/craft-queue-bouncer
More information about honchoagency/craft-queue-bouncer
Files in honchoagency/craft-queue-bouncer
Package craft-queue-bouncer
Short Description Prevent repeat jobs from being added to the queue
License mit
Informations about the package craft-queue-bouncer
Queue Bouncer for Craft CMS
A Craft CMS plugin that prevents duplicate jobs from piling up in the queue. If a matching job is already pending or running, Queue Bouncer skips the callback silently.
The Problem
Cron-triggered jobs can overlap. For example if a regular FeedMe import takes longer than its cron interval, a second job gets queued before the first finishes. Over time this creates a backlog that compounds the problem.
Queue Bouncer sits in front of your cron commands and acts as a gatekeeper - only running the callback function if there are no matching jobs in the queue.
Configuration
Copy config.php to config/queuebouncer.php and define your guarded jobs:
Each top-level key is an identifier you pass to the console command. A config entry supports these keys:
| Key | Description |
|---|---|
skipClasses |
Array of fully-qualified job class names. The callback is skipped if any are pending or running. Best for the simple case where the class name alone identifies the job. |
skipIf |
A callable returning true to skip the callback. Use this when you need finer control — for example to allow concurrent jobs of the same class but different feeds. Takes precedence over skipClasses when present. |
callback |
PHP callable invoked when the bouncer gives the green light. Omit it if you'd rather chain commands with && in cron. |
Advanced: skipIf
skipIf is useful when skipClasses is too broad. For example, if you run separate imports for multiple FeedMe feeds and want each one guarded independently:
Both keys can run concurrently — feed-me-import-17 won't block feed-me-import-42.
Usage
Replace your existing cron command with the Queue Bouncer equivalent:
Queue Bouncer will:
- Evaluate
skipIf(if configured) — if it returnstrue, exit cleanly. - Otherwise check
skipClasses— if any matching job is pending or running, exit cleanly. - If neither condition triggered, invoke the
callback.
License
MIT