A Guide to Clearing Laravel Queued Jobs

Laravel has a lot of helper artisan commands, one of them allows you to clear the cache.

php artisan cache:clear

Delete all queued jobs on a connection

This command has an optional parameter allowing you to define a connection to clear.

php artisan queue:clear {connection}
php artisan queue:clear {connection} --queue={queue}

This will clear the redis database redis-queue to quickly clear all queued jobs.

Clearing Failed Jobs

To clear Laravel queues, you can use the php artisan queue:flush command. This will clear all of the failed and pending jobs from the queue.

Alternatively, you can also clear a specific queue by specifying the queue name after the flush option, like this:

php artisan queue:flush queue_name

This will clear only the failed and pending jobs in the queue with the name queue_name.

Note that the queue:flush command will not delete any jobs that are currently being processed. If you want to delete all jobs, including the ones that are being processed, you can use the queue:forget command instead.

php artisan queue:forget job_id

This will delete the job with the specified job_id from the queue. You can find the job_id of a job by looking at the id column in the failed_jobs table.

UpChecker

Reliable uptime monitoring and instant alerts for any website downtime.

  • Uptime Monitoring
  • Performance Monitoring
  • SSL Certificate Alerts
  • Domain Monitoring
  • DNS Checker
  • XML Sitemap Monitoring