Method |
Description |
|
__construct ( mixed $queues = '*', boolean $blocking = true ) |
Create a new worker. |
|
__toString ( ) : string |
Generate a string representation of this worker. |
|
allWorkers ( Logger $logger = null ) : array |
Return all known workers |
|
cancelJob ( ) |
Cancel the currently running job |
|
cleanup ( ) |
Look for any workers which should be running on this server and if
they're not, remove them from Redis. |
|
doneWorking ( ) |
Notify Redis that we've finished working on a job, clearing the working
state and incrementing the job stats. |
|
forceShutdown ( ) |
Force an immediate shutdown of the worker, killing any child jobs
currently running. |
|
fromId ( string $id, Logger $logger = null ) : Worker |
Return a worker from it's ID |
|
getBlocking ( ) : boolean |
Get the queue blocking. |
|
getHost ( ) : Host |
Get the queue host. |
|
getId ( ) : string |
Get the worker id. |
|
getInterval ( ) : integer |
Get the worker interval. |
|
getLogger ( ) : Logger |
Get the logger instance |
|
getMemoryLimit ( ) : integer |
Get the queue memory limit. |
|
getPacket ( ) : array | false |
Fetch the packet for the worker |
|
getPid ( ) : integer |
Get the worker process id. |
|
getPidFile ( ) : string |
Get the worker pid file. |
|
getQueues ( ) : string |
Get the worker queues. |
|
getTimeout ( ) : integer |
Get the worker queue timeout. |
|
hostWorker ( string $id, string $host = null, Logger $logger = null ) : array | false |
Return host worker by id |
|
hostWorkers ( string $host = null, Logger $logger = null ) : array |
Return all known workers |
|
killChild ( ) |
Kill a forked child job immediately. The job it is processing will not
be completed. |
|
log ( ) : mixed |
Helper function that passes through to logger instance |
|
perform ( Job $job ) |
Process a single job |
|
queueDelayed ( integer $endTime = null, integer $startTime ) |
Find any delayed jobs and add them to the queue if found |
|
redisKey ( Worker $worker = null, string $suffix = null ) : string |
Get the Redis key |
|
register ( ) |
Register this worker in Redis and signal handlers that a worker should respond to |
|
resolveQueues ( ) : array |
Return an array containing all of the queues that this worker should use
when searching for jobs. |
|
setBlocking ( boolean $blocking ) |
Set the queue blocking |
|
setHost ( Host $host ) |
Set the queue host |
|
setId ( string $id ) |
Set the worker id |
|
setInterval ( integer $interval ) |
Set the worker interval |
|
setLogger ( Logger $logger = null ) |
Set the logger instance |
|
setMemoryLimit ( integer $memoryLimit ) |
Set the queue memory limit |
|
setPid ( integer $pid ) |
Set the worker process id - this is done when
worker is loaded from memory |
|
setPidFile ( string $pidFile ) |
Set the worker pid file |
|
setQueues ( string $queues ) : array |
Set the worker queues |
|
setStatus ( integer $status ) |
Update the status indicator for the current worker with a new status. |
|
setTimeout ( string $timeout ) : string |
Set the worker queue timeout |
|
shutdown ( ) |
Schedule a worker for shutdown. Will finish processing the current job
and when the timeout interval is reached, the worker will shut down. |
|
sigCancelJob ( ) |
Signal handler callback for USR1, cancel current job. |
|
sigForceShutdown ( integer $sig ) |
Signal handler callback for TERM or INT, forces shutdown of worker |
|
sigPause ( ) |
Signal handler callback for USR2, pauses processing of new jobs. |
|
sigResume ( ) |
Signal handler callback for CONT, resumes worker allowing it to pick
up new jobs. |
|
sigShutdown ( ) |
Signal handler callback for QUIT, shutdown the worker. |
|
sigWakeUp ( ) |
Signal handler for SIGPIPE, in the event the Redis connection has gone away. |
|
toArray ( ) : array |
Return array representation of this job |
|
unregister ( ) |
Unregister this worker in Redis |
|
work ( ) |
The primary loop for a worker which when called on an instance starts
the worker's life cycle. |
|
workingOn ( Job &$job ) |
Tell Redis which job we're currently working on. |
|