Skip to content

Commit

Permalink
修复 Swoole BASE 模式下获取 masterPid 错误 (#526)
Browse files Browse the repository at this point in the history
* 修复 BASE 模式下使用 masterPID 的地方改用 managerPID

* 修复 Swoole BASE 模式下获取 masterPid 错误
  • Loading branch information
Yurunsoft committed Jun 9, 2023
1 parent afad243 commit e1e1899
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Components/swoole/src/Worker/SwooleWorkerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,14 @@ public function getMasterPid(): int
/** @var ISwooleServer $server */
$server = ServerManager::getServer('main', ISwooleServer::class);

return $server->getSwooleServer()->master_pid;
if (\SWOOLE_BASE === $server->getSwooleServer()->mode)
{
return $this->getManagerPid();
}
else
{
return $this->getMasterPid();
}
}

/**
Expand Down

0 comments on commit e1e1899

Please sign in to comment.