This commit is contained in:
2021-09-06 16:44:33 +08:00
parent 6dc183a357
commit 8900ba4566
+9 -3
View File
@@ -4,6 +4,7 @@ namespace Server;
use Closure;
use Exception;
use Http\Route\Router;
use Kiri\Abstracts\Config;
use Kiri\Exception\ConfigException;
use Kiri\Exception\NotFindClassException;
@@ -138,19 +139,24 @@ class ServerManager
{
$server = $this->server;
return new Process(function (Process $soloProcess) use ($customProcess, $server) {
$time = microtime(true);
if (is_string($customProcess)) {
$customProcess = Kiri::createObject($customProcess, [$server]);
}
$name = $customProcess->getProcessName($soloProcess);
info(sprintf("Process %s start.", $name));
$namespace = array_filter(explode('\\', Router::getNamespace()));
scan_directory(directory('app'), 'App');
$namespace = APP_PATH . implode('/', $namespace);
$name = $customProcess->getProcessName($soloProcess);
scan_directory(directory('app'), 'App', [$namespace]);
$system = sprintf('%s.process[%d]', Config::get('id', 'system-service'), $soloProcess->pid);
if (Kiri::getPlatform()->isLinux()) {
$soloProcess->name($system . '.' . $name . ' start.');
}
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Builder %s[%d].%d use time %s.", 'Process',
$server->master_pid, $soloProcess->pid, round(microtime(true) - $time, 6) . 's') . PHP_EOL;
$customProcess->signListen($soloProcess);
$customProcess->onHandler($soloProcess);
},