Skip to content

Queue Commands Reference

Complete reference for all queue-related Artisan commands in the Volāre application.

Dispatch a test job to verify queue functionality.

Terminal window
./vendor/bin/sail artisan queue:test

What it does:

  • Dispatches a TestQueueJob with a test message
  • Confirms job was queued successfully
  • Provides next steps for monitoring

Display current queue status and pending jobs.

Terminal window
./vendor/bin/sail artisan queue:monitor

Example Output:

Queue Status:
Pending jobs: 5
Failed jobs: 0

Pro tip: Use with watch for live monitoring:

Terminal window
watch -n 2 './vendor/bin/sail artisan queue:monitor'

Start processing jobs on the queue.

Terminal window
./vendor/bin/sail artisan queue:work [connection] [options]

Important Options:

Option Description
--queue= Queues to process (comma-separated, priority order)
--once Process single job then exit
--stop-when-empty Stop when queue is empty
--sleep= Seconds to sleep when no jobs available (default: 3)
--tries= Number of times to attempt a job (default: 1)
--timeout= Maximum seconds a job should run (default: 60)
--max-time= Maximum seconds worker should run
--max-jobs= Maximum jobs to process before stopping
--memory= Memory limit in MB (default: 128)

Examples:

Terminal window
# Main worker (the `queue` service in compose.yaml) — queues in priority order
./vendor/bin/sail artisan queue:work \
--queue=aerticket-tickets,aerticket-fastlane,aerticket-bookings,aerticket-voids,pipedrive-sync,offer-recalculations,default \
--sleep=3 --tries=3 --max-time=3600
# Process one job and exit
./vendor/bin/sail artisan queue:work --once

compose.yaml runs two dedicated workers so customer-facing flight searches can’t be blocked by ticketing/booking work (and vice versa):

Service --queue= Handles
queue aerticket-tickets,aerticket-fastlane,aerticket-bookings,aerticket-voids,pipedrive-sync,offer-recalculations,default Ticketing, bookings, voids, Pipedrive sync, offer recalculations
queue-flights flight-searches SearchFlightCacheJob, CascadeFlightSearchForDateJob (customer-facing flight cache)

The default queue connection is database (config/queue.phpQUEUE_CONNECTION).

Production note: the production queue-worker ECR image runs a single worker that merges flight-searches into the main list (see backend/docker/common/queue-worker/queue-worker.sh), sized by QUEUE_WORKER_MEMORY. The two-worker split above is the dev compose.yaml layout.

Source: backend/compose.yaml, backend/config/queue.php

Listen to a queue and process jobs (with code reload).

Terminal window
./vendor/bin/sail artisan queue:listen [connection] [options]

Difference from queue:work:

  • Restarts framework on each job (slower but picks up code changes)
  • No need to manually restart after code changes
  • Not recommended for production

Signal all queue workers to restart after current job.

Terminal window
./vendor/bin/sail artisan queue:restart

When to use:

  • After deploying code changes
  • After config changes
  • After dependency updates

Retry failed jobs.

Terminal window
./vendor/bin/sail artisan queue:retry [id]

Examples:

Terminal window
# Retry all failed jobs
./vendor/bin/sail artisan queue:retry all
# Retry specific failed job
./vendor/bin/sail artisan queue:retry 9e3e9e3e-9e3e-9e3e-9e3e-9e3e9e3e9e3e
# Retry jobs from specific queue
./vendor/bin/sail artisan queue:retry all --queue=payments

Delete a failed job.

Terminal window
./vendor/bin/sail artisan queue:forget [id]

Delete all failed jobs.

Terminal window
./vendor/bin/sail artisan queue:flush

Warning: Use with caution in production!

List all failed jobs.

Terminal window
./vendor/bin/sail artisan queue:failed

Get detailed info:

Terminal window
./vendor/bin/sail artisan tinker
>>> $failed = DB::table('failed_jobs')->latest()->first();
>>> echo $failed->exception;

Delete all jobs from a queue.

Terminal window
./vendor/bin/sail artisan queue:clear database --queue=emails

Prune stale failed jobs.

Terminal window
# Prune jobs older than 24 hours (default)
./vendor/bin/sail artisan queue:prune-failed
# Prune jobs older than 7 days
./vendor/bin/sail artisan queue:prune-failed --hours=168

Prune stale batch records.

Terminal window
./vendor/bin/sail artisan queue:prune-batches --hours=720
Terminal window
# 1. Start development environment
./vendor/bin/sail up -d
# 2. Verify queue is working
./vendor/bin/sail artisan queue:test
# 3. Monitor queue status
./vendor/bin/sail artisan queue:monitor
# 4. Make code changes to your job
# 5. Restart workers to pick up changes
./vendor/bin/sail artisan queue:restart
# 6. Test your job
./vendor/bin/sail artisan tinker
>>> YourJob::dispatch($args);
# 7. Watch logs
./vendor/bin/sail artisan pail
Terminal window
# 1. List all failed jobs
./vendor/bin/sail artisan queue:failed
# 2. Get detailed error information
./vendor/bin/sail artisan tinker
>>> $failed = DB::table('failed_jobs')->latest()->first();
>>> echo $failed->exception;
# 3. Fix the underlying issue in code
# 4. Restart workers
./vendor/bin/sail artisan queue:restart
# 5. Retry the failed job
./vendor/bin/sail artisan queue:retry all

Production does not deploy via git pull. Backend images are built and pushed to ECR, then rolled out via the infra-volare workflow; queue workers run as their own containers. New containers start fresh (running the entrypoint optimizations), so there is no manual queue:restart step in a normal deploy.

See Deployment for the full pipeline.

Queue is Stuck:

Terminal window
# 1. Check what's in the queue
./vendor/bin/sail artisan queue:monitor
# 2. Check worker status
docker ps | grep queue
# 3. Restart worker container
./vendor/bin/sail restart queue
# 4. If still stuck, clear queue (CAUTION!)
./vendor/bin/sail artisan queue:clear database --queue=default

Too Many Failed Jobs:

Terminal window
# 1. Investigate cause
./vendor/bin/sail artisan tinker
>>> DB::table('failed_jobs')->latest()->first()->exception;
# 2. Fix underlying issue
# 3. Retry if fixable
./vendor/bin/sail artisan queue:retry all
# 4. Or flush if not recoverable
./vendor/bin/sail artisan queue:flush
Terminal window
# Testing & Monitoring
queue:test # Dispatch test job
queue:monitor # Show queue status
queue:failed # List failed jobs
# Worker Management
queue:work # Start processing (in Docker)
queue:restart # Gracefully restart workers
# Failed Job Management
queue:retry all # Retry all failed jobs
queue:retry {id} # Retry specific job
queue:forget {id} # Delete failed job
queue:flush # Delete all failed jobs
# Maintenance
queue:clear # Clear pending jobs
queue:prune-failed # Remove old failed jobs
queue:prune-batches # Remove old batch records
# Logging & Debugging
artisan pail # Follow Laravel logs
logs queue # View worker logs (Sail)
tinker # Interactive console