Last active
January 24, 2025 21:19
-
-
Save martin-ro/ef63dcee268340a42ce5386e7b368ce7 to your computer and use it in GitHub Desktop.
ClearQueueCommand
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Console\Commands; | |
use Illuminate\Console\Command; | |
use Illuminate\Support\Facades\Artisan; | |
use Illuminate\Support\Facades\DB; | |
use Illuminate\Support\Facades\Redis; | |
class ClearQueueCommand extends Command | |
{ | |
protected $signature = 'clear:queue-all'; | |
public function handle(): void | |
{ | |
Redis::connection(name: 'default')->client()->flushAll(); | |
DB::table('job_batches')->delete(); | |
Redis::connection()->del(['failed:*']); | |
Redis::connection()->del(['failed_jobs']); | |
Artisan::call('queue:clear'); | |
$this->info('Queue cleared.'); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment