Server::$worker_id
最后更新于:2022-04-02 06:21:16
# Server::$worker\_id
得到当前`Worker`进程的编号,包括`Task`进程。
~~~
int $server->worker_id;
~~~
这个属性与`onWorkerStart`时的`$worker_id`是相同的。
* `Worker`进程编号范围是`[0, $serv->setting['worker_num']]`
* `Task`进程编号范围是`[$serv->setting['worker_num'], $serv->setting['worker_num'] + $serv->setting['task_worker_num']]`
> 工作进程重启后`worker_id`的值是不变的
';