Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Lazy load queue commands #38479

Merged
merged 2 commits into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ protected function registerQueueListenCommand()
*/
protected function registerQueueMonitorCommand()
{
$this->app->singleton('command.queue.monitor', function ($app) {
$this->app->singleton(QueueMonitorCommand::class, function ($app) {
return new QueueMonitorCommand($app['queue'], $app['events']);
});
}
Expand All @@ -705,7 +705,7 @@ protected function registerQueuePruneBatchesCommand()
*/
protected function registerQueuePruneFailedJobsCommand()
{
$this->app->singleton('command.queue.prune-failed-jobs', function () {
$this->app->singleton(QueuePruneFailedJobsCommand::class, function () {
return new QueuePruneFailedJobsCommand;
});
}
Expand Down
9 changes: 9 additions & 0 deletions src/Illuminate/Queue/Console/MonitorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ class MonitorCommand extends Command
{queues : The names of the queues to monitor}
{--max=1000 : The maximum number of jobs that can be on the queue before an event is dispatched}';

/**
* The name of the console command.
*
* This name is used to identify the command during lazy loading.
*
* @var string|null
*/
protected static $defaultName = 'queue:monitor';

/**
* The console command description.
*
Expand Down
9 changes: 9 additions & 0 deletions src/Illuminate/Queue/Console/PruneFailedJobsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ class PruneFailedJobsCommand extends Command
protected $signature = 'queue:prune-failed
{--hours=24 : The number of hours to retain failed jobs data}';

/**
* The name of the console command.
*
* This name is used to identify the command during lazy loading.
*
* @var string|null
*/
protected static $defaultName = 'queue:prune-failed';

/**
* The console command description.
*
Expand Down