diff --git a/HttpServer/Events/OnWorkerStart.php b/HttpServer/Events/OnWorkerStart.php index 2d81c478..29e35e49 100644 --- a/HttpServer/Events/OnWorkerStart.php +++ b/HttpServer/Events/OnWorkerStart.php @@ -35,11 +35,12 @@ class OnWorkerStart extends Callback swoole_set_process_name($get_name); } - putenv('workerId=' . $worker_id); if ($worker_id >= $server->setting['worker_num']) { fire(Event::SERVER_TASK_START); + putenv('workerId=Task.' . $worker_id); return; } + putenv('workerId=Worker.' . $worker_id); Snowflake::setWorkerId($server->worker_pid); $this->setWorkerAction($worker_id); } diff --git a/System/Process/Process.php b/System/Process/Process.php index e91bfd4b..dfd1a1aa 100644 --- a/System/Process/Process.php +++ b/System/Process/Process.php @@ -33,6 +33,7 @@ abstract class Process extends \Swoole\Process implements SProcess $class = get_called_class(); parent::__construct(function ($process) use ($name, $class) { fire(Event::SERVER_WORKER_START); + putenv('workerId=Process.0'); if (Snowflake::isLinux()) { $prefix = ucfirst(rtrim(Snowflake::app()->id, ':')); $this->name($prefix . ': ' . $class);