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