Skip to content

Commit

Permalink
Allow to specify connection in ClearCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
antennaio committed Nov 20, 2024
1 parent 896fbdc commit db65b81
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Console/ClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ClearCommand extends Command
* @var string
*/
protected $signature = 'horizon:clear
{connection? : The name of the queue connection}
{--queue= : The name of the queue to clear}
{--force : Force the operation to run when in production}';

Expand Down Expand Up @@ -48,7 +49,8 @@ public function handle(JobRepository $jobRepository, QueueManager $manager)
return 1;
}

$connection = Arr::first($this->laravel['config']->get('horizon.defaults'))['connection'] ?? 'redis';
$connection = $this->argument('connection')
?: Arr::first($this->laravel['config']->get('horizon.defaults'))['connection'] ?? 'redis';

if (method_exists($jobRepository, 'purge')) {
$jobRepository->purge($queue = $this->getQueue($connection));
Expand Down

0 comments on commit db65b81

Please sign in to comment.