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

[5.3] Update and fix Queue commands #15677

Merged
merged 3 commits into from
Sep 29, 2016
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
54 changes: 11 additions & 43 deletions src/Illuminate/Queue/Console/DaemonCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
use Illuminate\Contracts\Queue\Job;
use Illuminate\Queue\Events\JobFailed;
use Illuminate\Queue\Events\JobProcessed;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;

class DaemonCommand extends Command
{
Expand All @@ -19,7 +17,17 @@ class DaemonCommand extends Command
*
* @var string
*/
protected $name = 'queue:daemon';
protected $signature = 'queue:work
{connection? : The name of connection}
{--queue= : The queue to listen on}
{--daemon : Run the worker in daemon mode (Deprecated)}
{--once : Only process the next job on the queue}
{--delay=0 : Amount of time to delay failed jobs}
{--force : Force the worker to run even in maintenance mode}
{--memory=128 : The memory limit in megabytes}
{--sleep=3 : Number of seconds to sleep when no job is available}
{--timeout=60 : The number of seconds a child process can run}
{--tries=0 : Number of times to attempt a job before logging it failed}';

/**
* The console command description.
Expand Down Expand Up @@ -181,44 +189,4 @@ protected function downForMaintenance()
{
return $this->option('force') ? false : $this->laravel->isDownForMaintenance();
}

/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return [
['connection', InputArgument::OPTIONAL, 'The name of connection', null],
];
}

/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return [
['queue', null, InputOption::VALUE_OPTIONAL, 'The queue to listen on'],

['daemon', null, InputOption::VALUE_NONE, 'Run the worker in daemon mode (Deprecated)'],

['once', null, InputOption::VALUE_NONE, 'Only process the next job on the queue'],

['delay', null, InputOption::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0],

['force', null, InputOption::VALUE_NONE, 'Force the worker to run even in maintenance mode'],

['memory', null, InputOption::VALUE_OPTIONAL, 'The memory limit in megabytes', 128],

['sleep', null, InputOption::VALUE_OPTIONAL, 'Number of seconds to sleep when no job is available', 3],

['timeout', null, InputOption::VALUE_OPTIONAL, 'The number of seconds a child process can run', 60],

['tries', null, InputOption::VALUE_OPTIONAL, 'Number of times to attempt a job before logging it failed', 0],
];
}
}
41 changes: 11 additions & 30 deletions src/Illuminate/Queue/Console/WorkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Console\Command;
use Symfony\Component\Process\Process;
use Symfony\Component\Console\Input\InputOption;

class WorkCommand extends Command
{
Expand All @@ -13,7 +12,17 @@ class WorkCommand extends Command
*
* @var string
*/
protected $name = 'queue:work';
protected $signature = 'queue:work
{connection? : The name of connection}
{--queue= : The queue to listen on}
{--daemon : Run the worker in daemon mode (Deprecated)}
{--once : Only process the next job on the queue}
{--delay=0 : Amount of time to delay failed jobs}
{--force : Force the worker to run even in maintenance mode}
{--memory=128 : The memory limit in megabytes}
{--sleep=3 : Number of seconds to sleep when no job is available}
{--timeout=60 : The number of seconds a child process can run}
{--tries=0 : Number of times to attempt a job before logging it failed}';

/**
* The console command description.
Expand Down Expand Up @@ -51,32 +60,4 @@ protected function newProxyProcess()
->setTimeout(null)
->setIdleTimeout($this->option('timeout') + $this->option('sleep'));
}

/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return [
['queue', null, InputOption::VALUE_OPTIONAL, 'The queue to listen on'],

['daemon', null, InputOption::VALUE_NONE, 'Run the worker in daemon mode (Deprecated)'],

['once', null, InputOption::VALUE_NONE, 'Only process the next job on the queue'],

['delay', null, InputOption::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0],

['force', null, InputOption::VALUE_NONE, 'Force the worker to run even in maintenance mode'],

['memory', null, InputOption::VALUE_OPTIONAL, 'The memory limit in megabytes', 128],

['sleep', null, InputOption::VALUE_OPTIONAL, 'Number of seconds to sleep when no job is available', 3],

['timeout', null, InputOption::VALUE_OPTIONAL, 'The number of seconds a child process can run', 60],

['tries', null, InputOption::VALUE_OPTIONAL, 'Number of times to attempt a job before logging it failed', 0],
];
}
}