Skip to content

Commit df67f06

Browse files
committed
Allow to retry jobs by queue name
1 parent 91c4547 commit df67f06

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Illuminate/Queue/Console/RetryCommand.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class RetryCommand extends Command
1818
*/
1919
protected $signature = 'queue:retry
2020
{id?* : The ID of the failed job or "all" to retry all jobs}
21+
{--queue= : Name of the queue to be retried}
2122
{--range=* : Range of job IDs (numeric) to be retried}';
2223

2324
/**
@@ -62,6 +63,16 @@ protected function getJobIds()
6263
return Arr::pluck($this->laravel['queue.failer']->all(), 'id');
6364
}
6465

66+
if ($queue = $this->option('queue')) {
67+
$ids = collect($this->laravel['queue.failer']->all())->where('queue', $queue)->pluck('id')->toArray();
68+
69+
if (count($ids)===0) {
70+
$this->error("Unable to find failed jobs in a queue named [{$queue}].");
71+
}
72+
73+
return $ids;
74+
}
75+
6576
if ($ranges = (array) $this->option('range')) {
6677
$ids = array_merge($ids, $this->getJobIdsByRanges($ranges));
6778
}

0 commit comments

Comments
 (0)