class ShutdownOnInterruptListener

Shut the server down gracefully on SIGINT (Ctrl+C), the same way Swoole handles SIGTERM.

Swoole does not handle SIGINT itself, so without this the default action kills the process that coordinates shutdown and skips its shutdown callbacks. Workers that receive the same signal from the terminal's process group still exit immediately unless they handle SIGINT themselves.

Methods

__construct(SignalRegistry $signals)

Create a new shutdown on interrupt listener instance.

void
handle(AfterWorkerStart|OnManagerStart|OnStart|OnWorkerExit $event)

Register the SIGINT shutdown in the process that coordinates server shutdown.

Details

at line 27
__construct(SignalRegistry $signals)

Create a new shutdown on interrupt listener instance.

Parameters

SignalRegistry $signals

at line 34
void handle(AfterWorkerStart|OnManagerStart|OnStart|OnWorkerExit $event)

Register the SIGINT shutdown in the process that coordinates server shutdown.

Parameters

AfterWorkerStart|OnManagerStart|OnStart|OnWorkerExit $event

Return Value

void