This commit is contained in:
2020-10-21 16:06:20 +08:00
parent 0ae525c86e
commit 91fa46b04e
2 changed files with 10 additions and 11 deletions
+10
View File
@@ -28,6 +28,16 @@ class OnManagerStart extends Callback
if (Snowflake::isLinux()) {
name('Server Manager.');
}
pcntl_signal(9 | 15, function () use ($server) {
$status = 0;
while ($ret = pcntl_waitpid($server->manager_pid, $status)) {
var_dump($ret);
break;
}
});
}
}
-11
View File
@@ -35,17 +35,6 @@ class OnShutdown extends Callback
{
$this->debug('server shutdown~');
$workers = glob(storage(null, 'worker') . '/*');
foreach ($workers as $worker) {
$content = file_get_contents($worker);
posix_kill($content, 9);
}
$content = '[error]: ' . date('Y-m-d H:i:s') . PHP_EOL;
$content .= print_r(swoole_last_error(), true);
Snowflake::writeFile(storage('shutdown.log'), $content, FILE_APPEND);
$this->system_mail('server shutdown~');
$event = Snowflake::app()->getEvent();
$event->trigger(Event::SERVER_SHUTDOWN);