Skip to content

Instantly share code, notes, and snippets.

@martin-ro
Last active January 24, 2025 21:19
Show Gist options
  • Save martin-ro/ef63dcee268340a42ce5386e7b368ce7 to your computer and use it in GitHub Desktop.
Save martin-ro/ef63dcee268340a42ce5386e7b368ce7 to your computer and use it in GitHub Desktop.
ClearQueueCommand
<?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