eee
This commit is contained in:
@@ -42,15 +42,26 @@ trait TraitServer
|
||||
*/
|
||||
public function onSigint($no, array $signInfo): void
|
||||
{
|
||||
static $handling = false;
|
||||
if ($handling) {
|
||||
return;
|
||||
}
|
||||
$handling = true;
|
||||
|
||||
try {
|
||||
$pidFile = function_exists('storage') ? storage('.swoole.pid') : '';
|
||||
$masterPid = is_file($pidFile) ? (int)trim((string)file_get_contents($pidFile)) : 0;
|
||||
if ($masterPid > 1 && $masterPid !== getmypid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Kiri::getLogger()->alert('Pid ' . getmypid() . ' get signo ' . $no);
|
||||
$this->shutdown();
|
||||
} catch (\Throwable $exception) {
|
||||
\Kiri::getLogger()->json_log($exception);
|
||||
\Kiri::getLogger()->json_log($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $signal
|
||||
* @param $callback
|
||||
|
||||
Reference in New Issue
Block a user