Join 4,000+ others and never miss out on new tips, tutorials, and more.
pecl install openswoole-22.0.0 | composer require openswoole/core:22.1.2
<?php OpenSwoole\Server->getWorkerStatus(int $workerId): int|bool
Return the worker process status value as an integer. This value indicates the workers state.
By passing in the worker process ID you can retrieve the worker status as an integer.
Worker Status Values
OpenSwoole\Constant::WORKER_BUSY(1): The worker process is busy.
OpenSwoole\Constant::WORKER_IDLE(2): The worker process is idle.
OpenSwoole\Constant::WORKER_EXIT(3): When you have the Swoole server set to reload on code changes, there may be two worker processes with the same ID, an old one and a new one, the old worker process waiting to finish and be replaced by the new one will have the exit status.
Available since > v4.5.0