改名
This commit is contained in:
@@ -35,11 +35,12 @@ class OnWorkerStart extends Callback
|
|||||||
swoole_set_process_name($get_name);
|
swoole_set_process_name($get_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
putenv('workerId=' . $worker_id);
|
|
||||||
if ($worker_id >= $server->setting['worker_num']) {
|
if ($worker_id >= $server->setting['worker_num']) {
|
||||||
fire(Event::SERVER_TASK_START);
|
fire(Event::SERVER_TASK_START);
|
||||||
|
putenv('workerId=Task.' . $worker_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
putenv('workerId=Worker.' . $worker_id);
|
||||||
Snowflake::setWorkerId($server->worker_pid);
|
Snowflake::setWorkerId($server->worker_pid);
|
||||||
$this->setWorkerAction($worker_id);
|
$this->setWorkerAction($worker_id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ abstract class Process extends \Swoole\Process implements SProcess
|
|||||||
$class = get_called_class();
|
$class = get_called_class();
|
||||||
parent::__construct(function ($process) use ($name, $class) {
|
parent::__construct(function ($process) use ($name, $class) {
|
||||||
fire(Event::SERVER_WORKER_START);
|
fire(Event::SERVER_WORKER_START);
|
||||||
|
putenv('workerId=Process.0');
|
||||||
if (Snowflake::isLinux()) {
|
if (Snowflake::isLinux()) {
|
||||||
$prefix = ucfirst(rtrim(Snowflake::app()->id, ':'));
|
$prefix = ucfirst(rtrim(Snowflake::app()->id, ':'));
|
||||||
$this->name($prefix . ': ' . $class);
|
$this->name($prefix . ': ' . $class);
|
||||||
|
|||||||
Reference in New Issue
Block a user