From 8ad44b700a76027c865e1e0395e1a405997263f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=93=AD=E6=98=95?= <715557344@qq.com> Date: Tue, 14 Aug 2018 16:11:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Drestart=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E4=BD=BF=E7=94=A8=E7=9A=84BUG=20(https://git?= =?UTF-8?q?hub.com/swoft-cloud/swoft-component/pull/180)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Bootstrap/Server/AbstractServer.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Bootstrap/Server/AbstractServer.php b/src/Bootstrap/Server/AbstractServer.php index 2ea9cdb1..ccdd62cb 100644 --- a/src/Bootstrap/Server/AbstractServer.php +++ b/src/Bootstrap/Server/AbstractServer.php @@ -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; } }