modify
This commit is contained in:
@@ -26,8 +26,10 @@ class ServerWorker extends \Server\Abstracts\Server
|
|||||||
*/
|
*/
|
||||||
public function onWorkerStart(Server $server, int $workerId)
|
public function onWorkerStart(Server $server, int $workerId)
|
||||||
{
|
{
|
||||||
|
$this->_setConfigCache($workerId);
|
||||||
$annotation = Snowflake::app()->getAnnotation();
|
$annotation = Snowflake::app()->getAnnotation();
|
||||||
$annotation->read(APP_PATH);
|
$annotation->read(APP_PATH);
|
||||||
|
|
||||||
$this->runEvent(Constant::WORKER_START, null, [$server, $workerId]);
|
$this->runEvent(Constant::WORKER_START, null, [$server, $workerId]);
|
||||||
if ($workerId >= $server->setting['worker_num'] + 1) {
|
if ($workerId >= $server->setting['worker_num'] + 1) {
|
||||||
$annotation->runtime(CONTROLLER_PATH);
|
$annotation->runtime(CONTROLLER_PATH);
|
||||||
@@ -41,7 +43,7 @@ class ServerWorker extends \Server\Abstracts\Server
|
|||||||
* @param $worker_id
|
* @param $worker_id
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function setConfigs($worker_id)
|
private function _setConfigCache($worker_id)
|
||||||
{
|
{
|
||||||
putenv('state=start');
|
putenv('state=start');
|
||||||
putenv('worker=' . $worker_id);
|
putenv('worker=' . $worker_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user