Skip to content

Commit

Permalink
兼容 Swoole 下 Worker::getWorkerNum()、Worker::getTaskWorkerNum() 类型问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Oct 15, 2021
1 parent 0b7ca55 commit 3269788
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Worker/SwooleWorkerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getWorkerNum(): int
{
/** @var ISwooleServer $server */
$server = ServerManager::getServer('main', ISwooleServer::class);
$this->workerNum = $server->getSwooleServer()->setting['worker_num'];
$this->workerNum = (int) $server->getSwooleServer()->setting['worker_num'];
}

return $this->workerNum;
Expand Down Expand Up @@ -123,7 +123,7 @@ public function getTaskWorkerNum(): int
{
/** @var ISwooleServer $server */
$server = ServerManager::getServer('main', ISwooleServer::class);
$this->taskWorkerNum = $server->getSwooleServer()->setting['task_worker_num'];
$this->taskWorkerNum = (int) $server->getSwooleServer()->setting['task_worker_num'];
}

return $this->taskWorkerNum;
Expand Down

0 comments on commit 3269788

Please sign in to comment.