2021-03-29 15:34:24 +08:00
|
|
|
|
<?php /** @noinspection PhpUnusedParameterInspection */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace ZM\Event\SwooleEvent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Swoole\Server;
|
|
|
|
|
|
use ZM\Annotation\Swoole\SwooleHandler;
|
|
|
|
|
|
use ZM\Console\Console;
|
|
|
|
|
|
use ZM\Event\SwooleEvent;
|
2021-11-16 15:41:01 +08:00
|
|
|
|
use ZM\Utils\DataProvider;
|
2021-03-29 15:34:24 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Class OnShutdown
|
|
|
|
|
|
* @package ZM\Event\SwooleEvent
|
|
|
|
|
|
* @SwooleHandler("shutdown")
|
|
|
|
|
|
*/
|
|
|
|
|
|
class OnShutdown implements SwooleEvent
|
|
|
|
|
|
{
|
|
|
|
|
|
public function onCall(Server $server) {
|
|
|
|
|
|
Console::verbose("正在关闭 Master 进程,pid=" . posix_getpid());
|
2021-11-16 15:41:01 +08:00
|
|
|
|
$pid_path = DataProvider::getWorkingDir() . "/.daemon_pid";
|
|
|
|
|
|
if (file_exists($pid_path)) {
|
|
|
|
|
|
unlink($pid_path);
|
|
|
|
|
|
}
|
2021-03-29 15:34:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|