class ProcessPool implements Countable

Properties

WorkerProcess> $processes

All of the active processes.

CarbonImmutable}> $terminatingProcesses

The processes that are terminating.

bool $working

Indicates if the process pool is currently running.

Closure|null $output

The output handler.

Methods

__construct(SupervisorOptions $options, Closure|null $output = null)

Create a new process pool instance.

void
scale(int $processes)

Scale the process count.

void
scaleUp(int $processes)

Scale up to the given number of processes.

void
scaleDown(int $processes)

Scale down to the given number of processes.

void
markForTermination(WorkerProcess $process)

Mark the given worker process for termination.

void
removeProcesses(int $count)

Remove the given number of processes from the process array.

start()

Add a new worker process to the pool.

createProcess()

Create a new process instance.

void
monitor()

Evaluate the current state of all of the processes.

void
restart()

Terminate all current workers and start fresh ones.

void
pause()

Pause all of the worker processes.

void
continue()

Instruct all of the worker processes to continue working.

terminatingProcesses()

Get the processes that are still terminating.

void
pruneTerminatingProcesses()

Remove any non-running processes from the terminating process list.

void
stopTerminatingProcessesThatAreHanging()

Stop any terminating processes that are hanging too long.

processes()

Get all of the current processes as a collection.

runningProcesses()

Get all of the current running processes as a collection.

int
totalProcessCount()

Get the total active process count, including processes pending termination.

string
queue()

The name of the queue(s) being worked by the pool.

int
count()

Count the total number of processes in the pool.

Details

at line 42
__construct(SupervisorOptions $options, Closure|null $output = null)

Create a new process pool instance.

Parameters

SupervisorOptions $options
Closure|null $output

at line 55
void scale(int $processes)

Scale the process count.

Parameters

int $processes

Return Value

void

at line 73
protected void scaleUp(int $processes)

Scale up to the given number of processes.

Parameters

int $processes

Return Value

void

at line 85
protected void scaleDown(int $processes)

Scale down to the given number of processes.

Parameters

int $processes

Return Value

void

at line 116
void markForTermination(WorkerProcess $process)

Mark the given worker process for termination.

Parameters

WorkerProcess $process

Return Value

void

at line 126
protected void removeProcesses(int $count)

Remove the given number of processes from the process array.

Parameters

int $count

Return Value

void

at line 134
protected ProcessPool start()

Add a new worker process to the pool.

Return Value

ProcessPool

at line 146
protected WorkerProcess createProcess()

Create a new process instance.

Return Value

WorkerProcess

at line 161
void monitor()

Evaluate the current state of all of the processes.

Return Value

void

at line 169
void restart()

Terminate all current workers and start fresh ones.

Return Value

void

at line 181
void pause()

Pause all of the worker processes.

Return Value

void

at line 191
void continue()

Instruct all of the worker processes to continue working.

Return Value

void

at line 201
Collection terminatingProcesses()

Get the processes that are still terminating.

Return Value

Collection

at line 211
void pruneTerminatingProcesses()

Remove any non-running processes from the terminating process list.

Return Value

void

at line 225
protected void stopTerminatingProcessesThatAreHanging()

Stop any terminating processes that are hanging too long.

Return Value

void

at line 239
Collection processes()

Get all of the current processes as a collection.

Return Value

Collection

at line 247
Collection runningProcesses()

Get all of the current running processes as a collection.

Return Value

Collection

at line 261
int totalProcessCount()

Get the total active process count, including processes pending termination.

Return Value

int

at line 269
string queue()

The name of the queue(s) being worked by the pool.

Return Value

string

at line 277
int count()

Count the total number of processes in the pool.

Return Value

int