class
Illuminate
/
Queue
/
Console
/
WorkCommand
WorkCommand
Extends
Properties
protected
$signature string
The console command name.
Default: 'queue:work
{connection? : The name of the queue connection to work}
{--name=default : The name of the worker}
{--queue= : The names of the queues to work}
{--daemon : Run the worker in daemon mode (Deprecated)}
{--once : Only process the next job on the queue}
{--stop-when-empty : Stop when the queue is empty}
{--delay=0 : The number of seconds to delay failed jobs (Deprecated)}
{--backoff=0 : The number of seconds to wait before retrying a job that encountered an uncaught exception}
{--max-jobs=0 : The number of jobs to process before stopping}
{--max-time=0 : The maximum number of seconds the worker should run}
{--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}
{--rest=0 : Number of seconds to rest between jobs}
{--timeout=60 : The number of seconds a child process can run}
{--tries=1 : Number of times to attempt a job before logging it failed}'
protected
$description string
The console command description.
Default: 'Start processing jobs on the queue as a daemon'
protected
$latestStartedAt float|null
Holds the start time of the last processed job, if any.
Default: null
Methods
public
__construct ( Worker $worker , Repository $cache ) : void
Create a new queue work command.
Parameters
- $worker Worker
- $cache Repository
public
handle ( ) : int|null
Execute the console command.
protected
runWorker ( $connection , $queue ) : int|null
Run the worker instance.
Parameters
- $connection string
- $queue string
protected
gatherWorkerOptions ( ) : WorkerOptions
Gather all of the queue worker options as a single object.
protected
listenForEvents ( ) : void
Listen for the queue events in order to update the console output.
protected
writeOutput ( Job $job , $status ) : void
Write the status output for the queue worker.
Parameters
- $job Job
- $status string
protected
formatRunTime ( $startTime ) : string
Given a start time, format the total run time for human readability.
Parameters
- $startTime float
protected
logFailedJob ( JobFailed $event ) : void
Store a failed job event.
Parameters
- $event JobFailed
protected
getQueue ( $connection ) : string
Get the queue name for the worker.
Parameters
- $connection string
protected
downForMaintenance ( ) : bool
Determine if the worker should run in maintenance mode.