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 53
void scale(int $processes)

Scale the process count.

Parameters

int $processes

Return Value

void

at line 71
protected void scaleUp(int $processes)

Scale up to the given number of processes.

Parameters

int $processes

Return Value

void

at line 83
protected void scaleDown(int $processes)

Scale down to the given number of processes.

Parameters

int $processes

Return Value

void

at line 114
void markForTermination(WorkerProcess $process)

Mark the given worker process for termination.

Parameters

WorkerProcess $process

Return Value

void

at line 124
protected void removeProcesses(int $count)

Remove the given number of processes from the process array.

Parameters

int $count

Return Value

void

at line 132
protected ProcessPool start()

Add a new worker process to the pool.

Return Value

ProcessPool

at line 144
protected WorkerProcess createProcess()

Create a new process instance.

Return Value

WorkerProcess

at line 159
void monitor()

Evaluate the current state of all of the processes.

Return Value

void

at line 167
void restart()

Terminate all current workers and start fresh ones.

Return Value

void

at line 179
void pause()

Pause all of the worker processes.

Return Value

void

at line 189
void continue()

Instruct all of the worker processes to continue working.

Return Value

void

at line 199
Collection terminatingProcesses()

Get the processes that are still terminating.

Return Value

Collection

at line 209
void pruneTerminatingProcesses()

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

Return Value

void

at line 223
protected void stopTerminatingProcessesThatAreHanging()

Stop any terminating processes that are hanging too long.

Return Value

void

at line 237
Collection processes()

Get all of the current processes as a collection.

Return Value

Collection

at line 245
Collection runningProcesses()

Get all of the current running processes as a collection.

Return Value

Collection

at line 259
int totalProcessCount()

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

Return Value

int

at line 267
string queue()

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

Return Value

string

at line 275
int count()

Count the total number of processes in the pool.

Return Value

int