This commit is contained in:
2021-08-17 18:45:22 +08:00
parent 97c5d94a64
commit a943a6ca25
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -157,7 +157,7 @@ class ServerManager
* @param array $ports
* @return array
*/
private function sortService(array $ports): array
public function sortService(array $ports): array
{
$array = [];
foreach ($ports as $port) {
@@ -315,7 +315,8 @@ class ServerManager
return;
}
while ($this->checkPortIsAlready($port)) {
exec('kill ' . $pid, $execResult);
exec('kill -15 ' . $pid, $execResult);
Process::kill($pid,);
usleep(300);
}
}
+1 -1
View File
@@ -131,7 +131,7 @@ class Server extends HttpService
public function shutdown()
{
$configs = Config::get('server', [], true);
foreach ($configs['ports'] ?? [] as $config) {
foreach ($this->manager->sortService($configs) as $config) {
$this->manager->stopServer($config['port']);
}
$this->eventDispatch->dispatch(new OnShutdown());