Skip to content

Commit

Permalink
[10.x] Add exit code to queue:clear, and queue:forget commands (#49707)
Browse files Browse the repository at this point in the history
* [10.x] Add exit code to queue:clear, and queue:forget commands

* Update ClearCommand.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
bytestream and taylorotwell authored Jan 16, 2024
1 parent 7cbdae5 commit 03eabd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Illuminate/Queue/Console/ClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public function handle()
$this->components->info('Cleared '.$count.' '.Str::plural('job', $count).' from the ['.$queueName.'] queue');
} else {
$this->components->error('Clearing queues is not supported on ['.(new ReflectionClass($queue))->getShortName().']');

return 1;
}

return 0;
Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Queue/Console/ForgetFailedCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ class ForgetFailedCommand extends Command
/**
* Execute the console command.
*
* @return void
* @return int|null
*/
public function handle()
{
if ($this->laravel['queue.failer']->forget($this->argument('id'))) {
$this->components->info('Failed job deleted successfully.');
} else {
$this->components->error('No failed job matches the given ID.');

return 1;
}
}
}

0 comments on commit 03eabd5

Please sign in to comment.