diff --git a/HttpServer/Server.php b/HttpServer/Server.php index 54bc8578..41419f48 100644 --- a/HttpServer/Server.php +++ b/HttpServer/Server.php @@ -251,10 +251,6 @@ class Server extends Application $system->write(Json::encode($this->params[$name])); } $this->baseServer->addProcess($system); - if (Snowflake::isLinux()) { - $prefix = ucfirst(rtrim(Snowflake::app()->id, ':')); - $system->name($prefix . ': ' . $name . '::' . $process); - } $application->set($process, $system); } } diff --git a/System/Process/Process.php b/System/Process/Process.php index addbbf44..77d638b1 100644 --- a/System/Process/Process.php +++ b/System/Process/Process.php @@ -29,7 +29,12 @@ abstract class Process extends \Swoole\Process */ public function __construct($application, $name, $enable_coroutine = true) { - parent::__construct(function ($process) use ($name) { + $class = get_called_class(); + parent::__construct(function ($process) use ($name, $class) { + if (Snowflake::isLinux()) { + $prefix = ucfirst(rtrim(Snowflake::app()->id, ':')); + $this->name($prefix . ': ' . $class); + } $this->onHandler($process); }, false, 1, $enable_coroutine); $this->application = $application;