Свойство | Type | Description | |
---|---|---|---|
$statusText | Worker status constants as text |
Свойство | Type | Description | |
---|---|---|---|
$blocking | True if uses Redis pop blocking | ||
$child | Process ID of child worker processes. | ||
$host | The host of this worker. | ||
$id | String identifying this worker. | ||
$interval | Clock speed | ||
$job | Current job, if any, being processed by this worker. | ||
$logger | logger instance | ||
$memoryLimit | Memory limit of worker, if exceeded worker will stop | ||
$pid | Process id of this worker | ||
$pidFile | File to store process id in | ||
$queues | Array of all associated queues for this worker. | ||
$redis | The Redis instance. | ||
$shutdown | True if on the next iteration, the worker should shutdown. | ||
$shutdownErrors | List of shutdown errors to catch | ||
$status | Status of the worker. | ||
$timeout | Max execution time of job |
Méthode | Description | |
---|---|---|
__construct ( mixed $queues = '*', boolean $blocking = true ) | Create a new worker. | |
__toString ( ) : string | Generate a string representation of this worker. | |
allWorkers ( |
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, |
Return a worker from it's ID | |
getBlocking ( ) : boolean | Get the queue blocking. | |
getHost ( ) : |
Get the queue host. | |
getId ( ) : string | Get the worker id. | |
getInterval ( ) : integer | Get the worker interval. | |
getLogger ( ) : |
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, |
Return host worker by id | |
hostWorkers ( string $host = null, |
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 ( |
Process a single job | |
queueDelayed ( integer $endTime = null, integer $startTime ) | Find any delayed jobs and add them to the queue if found | |
redisKey ( |
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 ( |
Set the queue host | |
setId ( string $id ) | Set the worker id | |
setInterval ( integer $interval ) | Set the worker interval | |
setLogger ( |
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 ( |
Tell Redis which job we're currently working on. |
Méthode | Description | |
---|---|---|
getProcessTitle ( $status ) | Creates process title string from current version and status of worker | |
interval_string ( ) : string | Returns formatted interval string | |
memoryExceeded ( ) : boolean | Determine if the memory limit has been exceeded. | |
startup ( ) | Perform necessary actions to start a worker | |
updateProcLine ( string $status ) | On supported systems, update the name of the currently running process to indicate the current state of a worker. |
public __construct ( mixed $queues = '*', boolean $blocking = true ) | ||
$queues | mixed | Queues for the worker to watch |
$blocking | boolean | Use Redis blocking |
public __toString ( ) : string | ||
Résultat | string | String identifier for this worker instance. |
public static allWorkers ( |
||
$logger | ||
Résultat | array |
public cleanup ( ) |
public doneWorking ( ) |
public forceShutdown ( ) |
public getBlocking ( ) : boolean | ||
Résultat | boolean |
public getInterval ( ) : integer | ||
Résultat | integer |
public getMemoryLimit ( ) : integer | ||
Résultat | integer | Memory limit |
protected getProcessTitle ( $status ) |
public getTimeout ( ) : integer | ||
Résultat | integer | Worker queue timeout |
public static hostWorkers ( string $host = null, |
||
$host | string | Hostname |
$logger | Logger | |
Résultat | array |
protected interval_string ( ) : string | ||
Résultat | string |
public killChild ( ) |
protected memoryExceeded ( ) : boolean | ||
Résultat | boolean |
public perform ( |
||
$job | The job to be processed. |
public queueDelayed ( integer $endTime = null, integer $startTime ) | ||
$endTime | integer | optional end time for range |
$startTime | integer | optional start time for range |
public register ( ) |
public resolveQueues ( ) : array | ||
Résultat | array | Array of associated queues. |
public setBlocking ( boolean $blocking ) | ||
$blocking | boolean | Should worker use Redis blocking |
public setHost ( |
||
$host | The host to set for this worker |
public setInterval ( integer $interval ) | ||
$interval | integer | The worker interval |
public setLogger ( |
||
$logger | The logger for this worker |
public setMemoryLimit ( integer $memoryLimit ) | ||
$memoryLimit | integer | Memory limit |
public setPidFile ( string $pidFile ) | ||
$pidFile | string | Filename to store pid in |
public setTimeout ( string $timeout ) : string | ||
$timeout | string | Worker queue timeout |
Résultat | string |
public shutdown ( ) |
public sigCancelJob ( ) |
public sigForceShutdown ( integer $sig ) | ||
$sig | integer | Signal that was sent |
public sigPause ( ) |
public sigResume ( ) |
public sigShutdown ( ) |
public sigWakeUp ( ) |
protected updateProcLine ( string $status ) | ||
$status | string | The updated process title. |
public workingOn ( |
||
$job | Job instance containing the job we're working on. |
protected $memoryLimit |
protected $shutdown |