man-u-l
2 months ago
641
3
Laravel

Clear Horizon failed jobs Redis

Posted 2 months ago by man-u-l

I have done a few things to try to clear Horizon failed jobs but the only thing that works is if I manually go to the Redis keys and delete them under horizon:failed_jobs

I even made a horizon:flush command like so:

public function handle() {
        $this->info('Calling queue:flush ...');
        $this->call('queue:flush');
        foreach ([config('horizon.prefix') . 'failed:*', config('horizon.prefix') . 'failed_jobs'] as $delCommand) {
            $this->info('In Redis, calling `del` with: ' . $delCommand);
            Redis::connection()->del([$delCommand]);
        }
        $this->info('Deleted each individual failed job from Horizon and deleted failed_jobs from Horizon.');
    }

But in the Horizon failed jobs tab they never get deleted.

Im running latest version of Laravel and Horizon as of today.

Please sign in or create an account to participate in this conversation.