Processor
in package
uses
LocatorAwareTrait
Main shell to init and run queue workers.
Table of Contents
Properties
- $container : ContainerInterface|null
- $exit : bool
- $io : Io
- $logger : LoggerInterface
- $pid : string|null
- $QueuedJobs : QueuedJobsTable
- $QueueProcesses : QueueProcessesTable
- $taskConf : array<string, array<string, mixed>>|null
- $time : int
Methods
- __construct() : mixed
- run() : int
- abort() : void
- Signal handling for Ctrl+C
- deletePid() : void
- exit() : void
- Signal handling to queue worker for clean shutdown
- getConfig() : array<string, mixed>
- getTaskClass() : string
- getTaskConf() : array<string, array<string, mixed>>
- Returns a List of available QueueTasks and their individual configuration.
- initPid() : string
- loadTask() : TaskInterface
- log() : void
- Timestamped log.
- logError() : void
- memoryUsage() : string
- retrievePid() : string
- runJob() : void
- setPhpTimeout() : void
- Makes sure accidental overriding isn't possible, uses workermaxruntime times 100 by default.
- stringToArray() : array<string|int, string>
- time() : int
- timeNeeded() : string
- updatePid() : void
Properties
$container
protected
ContainerInterface|null
$container
= null
$exit
protected
bool
$exit
= false
$io
protected
Io
$io
$logger
protected
LoggerInterface
$logger
$pid
protected
string|null
$pid
= null
$QueuedJobs
protected
QueuedJobsTable
$QueuedJobs
$QueueProcesses
protected
QueueProcessesTable
$QueueProcesses
$taskConf
protected
array<string, array<string, mixed>>|null
$taskConf
= null
$time
protected
int
$time
= 0
Methods
__construct()
public
__construct(Io $io, LoggerInterface $logger[, ContainerInterface|null $container = null ]) : mixed
Parameters
- $io : Io
- $logger : LoggerInterface
- $container : ContainerInterface|null = null
run()
public
run(array<string, mixed> $args) : int
Parameters
- $args : array<string, mixed>
Return values
intabort()
Signal handling for Ctrl+C
protected
abort([int $signal = 1 ]) : void
Parameters
- $signal : int = 1
deletePid()
protected
deletePid(string|null $pid) : void
Parameters
- $pid : string|null
exit()
Signal handling to queue worker for clean shutdown
protected
exit(int $signal) : void
Parameters
- $signal : int
getConfig()
protected
getConfig(array<string, mixed> $args) : array<string, mixed>
Parameters
- $args : array<string, mixed>
Return values
array<string, mixed>getTaskClass()
protected
getTaskClass(string $taskName) : string
Parameters
- $taskName : string
Tags
Return values
stringgetTaskConf()
Returns a List of available QueueTasks and their individual configuration.
protected
getTaskConf() : array<string, array<string, mixed>>
Return values
array<string, array<string, mixed>>initPid()
protected
initPid() : string
Return values
stringloadTask()
protected
loadTask(string $taskName) : TaskInterface
Parameters
- $taskName : string
Return values
TaskInterfacelog()
Timestamped log.
protected
log(string $message[, string|null $pid = null ][, bool $addDetails = true ]) : void
Parameters
- $message : string
-
Log type
- $pid : string|null = null
-
PID of the process
- $addDetails : bool = true
logError()
protected
logError(string $message[, string|null $pid = null ]) : void
Parameters
- $message : string
- $pid : string|null = null
-
PID of the process
memoryUsage()
protected
memoryUsage() : string
Return values
string —Memory usage in MB.
retrievePid()
protected
retrievePid() : string
Return values
stringrunJob()
protected
runJob(QueuedJob $queuedJob, string $pid) : void
Parameters
- $queuedJob : QueuedJob
- $pid : string
setPhpTimeout()
Makes sure accidental overriding isn't possible, uses workermaxruntime times 100 by default.
protected
setPhpTimeout() : void
If available, uses workertimeout config directly.
stringToArray()
protected
stringToArray(string $param) : array<string|int, string>
Parameters
- $param : string
Return values
array<string|int, string>time()
protected
time([int|null $providedTime = null ]) : int
Parameters
- $providedTime : int|null = null
Return values
inttimeNeeded()
protected
timeNeeded() : string
Return values
stringupdatePid()
protected
updatePid(string $pid) : void
Parameters
- $pid : string