public function onWorkerStart(Server $server, int $workerId)
    {
        // Init Worker and TaskWorker
        $setting = $server->setting;
        $isWorker = false;

        if ($workerId >= $setting['worker_num']) {
            // TaskWorker
            ApplicationContext::setContext(ApplicationContext::TASK);
            ProcessHelper::setProcessTitle($this->serverSetting['pname'] . ' task process');
        } else {
            // Worker
            $isWorker = true;
            ApplicationContext::setContext(ApplicationContext::WORKER);
            ProcessHelper::setProcessTitle($this->serverSetting['pname'] . ' worker process');
        }

        $this->beforeWorkerStart($server, $workerId, $isWorker);

        $this->fireServerEvent(SwooleEvent::ON_WORKER_START, [$server, $workerId, $isWorker]);
    }
public function onWorkerStart(Server $server, int $workerId)
    {
        // Init Worker and TaskWorker
        $setting = $server->setting;
        $isWorker = false;

        if ($workerId >= $setting['worker_num']) {
            // TaskWorker
            ApplicationContext::setContext(ApplicationContext::TASK);
            ProcessHelper::setProcessTitle($this->serverSetting['pname'] . ' task process');
        } else {
            // Worker
            $isWorker = true;
            ApplicationContext::setContext(ApplicationContext::WORKER);
            ProcessHelper::setProcessTitle($this->serverSetting['pname'] . ' worker process');
        }

        $this->beforeWorkerStart($server, $workerId, $isWorker);

        $this->fireServerEvent(SwooleEvent::ON_WORKER_START, [$server, $workerId, $isWorker]);
    }
public function onWorkerStart ( Server $ server , int $ workerId ) { // Init Worker and TaskWorker $ setting = $ server -> setting ; $ isWorker = false ; if ( $ workerId >= $ setting [ 'worker_num' ] ) { // TaskWorker ApplicationContext :: setContext ( ApplicationContext :: TASK ) ; ProcessHelper :: setProcessTitle ( $ this -> serverSetting [ 'pname' ] . ' task process' ) ; } else { // Worker $ isWorker = true ; ApplicationContext :: setContext ( ApplicationContext :: WORKER ) ; ProcessHelper :: setProcessTitle ( $ this -> serverSetting [ 'pname' ] . ' worker process' ) ; } $ this -> beforeWorkerStart ( $ server , $ workerId , $ isWorker ) ; $ this -> fireServerEvent ( SwooleEvent :: ON_WORKER_START , [ $ server , $ workerId , $ isWorker ] ) ; }
OnWorkerStart event callback

@param Server $server server
@param int $workerId workerId
@throws \InvalidArgumentException
@throws \ReflectionException
OnWorkerStart event callback