Skip to content

Commit

Permalink
修复restart不能正常使用的BUG (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo authored and huangzhhui committed Aug 14, 2018
1 parent 7775f2c commit 43997d0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/framework/src/Bootstrap/Server/AbstractServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,23 @@ public function reload($onlyTask = false)
*/
public function stop(): bool
{
//获取master进程ID
// 获取master进程ID
$masterPid = $this->serverSetting['masterPid'];
//使用swoole_process::kill代替posix_kill
// 使用swoole_process::kill代替posix_kill
$result = \swoole_process::kill($masterPid);
$timeout = 60;
$startTime = time();
while (true) {
//检测进程是否退出
if(!\swoole_process::kill($masterPid, 0)) {
//判断是否超时
if(time() - $startTime >= $timeout) {
// Check the process status
if (\swoole_process::kill($masterPid, 0)) {
// 判断是否超时
if (time() - $startTime >= $timeout) {
return false;
}
usleep(10000);
continue;
}

return true;
}
}
Expand Down

0 comments on commit 43997d0

Please sign in to comment.