This commit is contained in:
2021-07-06 16:30:17 +08:00
parent 5aae1f0ba4
commit d0c579455d
+2 -1
View File
@@ -28,7 +28,6 @@ abstract class Process extends \Swoole\Process implements SProcess
public function __construct($application, $name, $enable_coroutine = true) public function __construct($application, $name, $enable_coroutine = true)
{ {
parent::__construct([$this, '_load'], false, 1, $enable_coroutine); parent::__construct([$this, '_load'], false, 1, $enable_coroutine);
Snowflake::setProcessId($this->pid);
} }
/** /**
@@ -37,6 +36,8 @@ abstract class Process extends \Swoole\Process implements SProcess
*/ */
public function _load(Process $process) public function _load(Process $process)
{ {
Snowflake::setProcessId($this->pid);
putenv('environmental=' . Snowflake::PROCESS); putenv('environmental=' . Snowflake::PROCESS);
fire(Event::SERVER_WORKER_START); fire(Event::SERVER_WORKER_START);