Preetesh Jain

How to completely clear failed jobs in Laravel Horizon

Ever ran into an issue where Laravel Horizon doesn't clear failed jobs even after you run php artisan queue:flush? Right now it clears automatically in 7 days, but sometimes during development you need to clear it right away so you can test new changes.

Currently there's no support built inside Laravel to do that and there's no button in Horizon's UI to clear this either. So this issue is kind of frustrating.

Here's what I've done to flush failed Redis jobs with a simple command:

Create a new command:

php artisan make:command FlushRedis --command=flush:redis

Add this use statement to your command:

use Illuminate\Support\Facades\Redis;

Note: If you add use Redis; on the command file, it will lead to errors, because it can't be called statically.

Now in the handle() method of this command, add this line:


Register this command in App\Console\Kernel.php:

protected $commands = [

All done!

Now you can simply run this command in the future to clear all the jobs from Redis (and Horizon):

php artisan flush:redis

This should be the output:


Related GitHub Issue