This commit is contained in:
2020-09-11 19:53:26 +08:00
parent b27dacba3b
commit 87630e287a
+4 -2
View File
@@ -30,11 +30,13 @@ abstract class Process extends \Swoole\Process
*/ */
public function __construct($application, $name) public function __construct($application, $name)
{ {
parent::__construct([$this, 'onHandler'], false, 1, true); parent::__construct(function (\Swoole\Process $process) use ($name) {
$this->application = $application;
if (Snowflake::isLinux()) { if (Snowflake::isLinux()) {
$this->name($name); $this->name($name);
} }
$this->onHandler($process);
}, false, 1, true);
$this->application = $application;
Snowflake::setWorkerId($this->pid); Snowflake::setWorkerId($this->pid);
} }