This commit is contained in:
as2252258@163.com
2021-07-26 02:55:55 +08:00
parent 5fa407d697
commit 2e4e79cef2
4 changed files with 27 additions and 18 deletions
+21
View File
@@ -6,7 +6,9 @@ namespace Server\Abstracts;
use Closure;
use Exception;
use Snowflake\Abstracts\Config;
use Snowflake\Event;
use Snowflake\Exception\ConfigException;
use Snowflake\Snowflake;
@@ -24,6 +26,25 @@ abstract class Server
protected Event $_event;
/**
* @param $prefix
* @throws ConfigException
*/
protected function setProcessName($prefix)
{
if (Snowflake::getPlatform()->isMac()) {
return;
}
$name = Config::get('id', 'system-service');
if (!empty($prefix)) {
$name .= '.' . $prefix;
}
swoole_set_process_name($name);
}
/**
* Server constructor.
* @throws Exception