This commit is contained in:
as2252258@163.com
2021-07-26 02:58:45 +08:00
parent 2e4e79cef2
commit b8f8d9162c
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ class ServerDefaultEvent extends Server
*/ */
public function onStart(\Swoole\Server $server) public function onStart(\Swoole\Server $server)
{ {
$this->setProcessName(sprintf('start[%d].server', $server->worker_pid)); $this->setProcessName(sprintf('start[%d].server', $server->master_pid));
$this->runEvent(Constant::START, null, [$server]); $this->runEvent(Constant::START, null, [$server]);
} }
+1 -1
View File
@@ -19,7 +19,7 @@ class ServerManager extends Server
*/ */
public function onManagerStart(\Swoole\Server $server) public function onManagerStart(\Swoole\Server $server)
{ {
$this->setProcessName(sprintf('manger[%d].0', $server->worker_pid)); $this->setProcessName(sprintf('manger[%d].0', $server->manager_pid));
$this->runEvent(Constant::MANAGER_START, null, [$server]); $this->runEvent(Constant::MANAGER_START, null, [$server]);
} }
+2 -2
View File
@@ -54,14 +54,14 @@ class ServerWorker extends \Server\Abstracts\Server
$loader->_loader(); $loader->_loader();
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Worker[%d].%d start.", $server->worker_pid, $workerId) . PHP_EOL; echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Worker[%d].%d start.", $server->worker_pid, $workerId) . PHP_EOL;
$this->setProcessName(sprintf('Worker[%d].%d', $workerId, $server->worker_pid)); $this->setProcessName(sprintf('Worker[%d].%d', $server->worker_pid, $workerId));
$annotation->runtime(CONTROLLER_PATH); $annotation->runtime(CONTROLLER_PATH);
$annotation->runtime(MODEL_PATH); $annotation->runtime(MODEL_PATH);
} else { } else {
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Tasker[%d].%d start.", $server->worker_pid, $workerId) . PHP_EOL; echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Tasker[%d].%d start.", $server->worker_pid, $workerId) . PHP_EOL;
$this->setProcessName(sprintf('Tasker[%d].%d', $workerId, $server->worker_pid)); $this->setProcessName(sprintf('Tasker[%d].%d', $server->worker_pid, $workerId));
$annotation->runtime(APP_PATH, [CONTROLLER_PATH]); $annotation->runtime(APP_PATH, [CONTROLLER_PATH]);
} }