This commit is contained in:
2021-01-28 11:27:53 +08:00
parent f8c79b148e
commit fb0d3a4b9b
4 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -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();
}
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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) {
+3 -3
View File
@@ -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);
}