diff --git a/System/Abstracts/BaseApplication.php b/System/Abstracts/BaseApplication.php index 01ab2b96..638d0313 100644 --- a/System/Abstracts/BaseApplication.php +++ b/System/Abstracts/BaseApplication.php @@ -377,7 +377,7 @@ abstract class BaseApplication extends Service * @return Http|Packet|Receive|Websocket|null * @throws ComponentException */ - public function getService(): Packet|Websocket|Receive|Http|null + public function getSwoole(): Packet|Websocket|Receive|Http|null { return $this->getServer()->getServer(); } diff --git a/System/Async.php b/System/Async.php index e4a2ae8f..01acdc69 100644 --- a/System/Async.php +++ b/System/Async.php @@ -22,7 +22,7 @@ class Async extends Component */ public function dispatch(Task $class) { - $server = Snowflake::app()->server->getServer(); + $server = Snowflake::app()->getSwoole(); if (!isset($server->setting['task_worker_num']) || !class_exists($class)) { return; } diff --git a/System/Process/Biomonitoring.php b/System/Process/Biomonitoring.php index e0e39ad4..8a3f3d1a 100644 --- a/System/Process/Biomonitoring.php +++ b/System/Process/Biomonitoring.php @@ -22,7 +22,7 @@ class Biomonitoring extends Process */ public function onHandler(\Swoole\Process $process): void { - $server = Snowflake::app()->getService(); + $server = Snowflake::app()->getSwoole(); Timer::tick(1000, function () use ($server) { clearstatcache(); if (($size = filesize($server->setting['log_file'])) > 1024000000) { diff --git a/System/Snowflake.php b/System/Snowflake.php index bc3f0bde..18b5deb9 100644 --- a/System/Snowflake.php +++ b/System/Snowflake.php @@ -225,7 +225,7 @@ class Snowflake */ public static function getWebSocket(): ?Server { - $server = static::app()->server->getServer(); + $server = static::app()->getSwoole(); if (!($server instanceof Server)) { return null; } @@ -273,7 +273,7 @@ class Snowflake */ public static function async(string $class, array $params = []) { - $server = static::app()->server->getServer(); + $server = static::app()->getSwoole(); if (!isset($server->setting['task_worker_num']) || !class_exists($class)) { return; } @@ -317,7 +317,7 @@ class Snowflake */ public static function shutdown($process): void { - static::app()->server->getServer()->shutdown(); + static::app()->getSwoole()->shutdown(); if ($process instanceof Process) { $process->exit(0); }