›
byrcsc/laravel-assignment · 1.x
The package ships one command, which expires overdue offers and flushes the queue.
php artisan assignment:tickAdvances expired assignment offers and flushes the assignment queue. It takes no arguments and no options.
Expired 3 offer(s) and assigned 1 queued item(s).The command always exits 0. A run with nothing to do reports zeros.
offered and whose
expires_at has passed, reading them in batches of 100. Each one is ended
with reason expired, dispatches OfferExpired, and has its
cascade advanced to the next candidate.The order matters: an offer that exhausts its cascade during step 1 is queued, and step 2 can pick it up in the same run with a fresh cascade.
// routes/console.php
use Illuminate\Support\Facades\Schedule;
Schedule::command('assignment:tick')->everyMinute();Every minute is a sensible default. Nothing about correctness depends on the cadence: an overdue offer stops holding its slot on its timestamp, whether or not the command has run. What the cadence controls is how long a declined or expired offer sits before moving on.
On a busy installation, add withoutOverlapping() so a slow run does not stack
up behind itself. The work is safe to run concurrently either way, since expiry
and the flush both claim rows before acting on them.
Schedule::command('assignment:tick')
->everyMinute()
->withoutOverlapping();The flush half is available on its own:
use ByRcsc\LaravelAssignment\Facades\Assignment;
Assignment::flushQueue();
Assignment::flushQueue(Callout::class);The expiry half has no public entry point other than this command, so schedule
assignment:tick when you want expiry processed.
Splitting them is worth doing when you flush on your own domain events, such as a crew becoming available, and want expiry swept on a schedule without the immediate re-offer that a combined run can produce.
make:class is
enough.