From 87630e287ad14de48fa5ffb7ddc1cd2173482bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 11 Sep 2020 19:53:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Process/Process.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/System/Process/Process.php b/System/Process/Process.php index 19e23684..7b3b062a 100644 --- a/System/Process/Process.php +++ b/System/Process/Process.php @@ -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); }