Files
zhamao-framework/src/ZM/Event/SwooleEvent/OnShutdown.php
2021-11-16 15:41:01 +08:00

27 lines
641 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php /** @noinspection PhpUnusedParameterInspection */
namespace ZM\Event\SwooleEvent;
use Swoole\Server;
use ZM\Annotation\Swoole\SwooleHandler;
use ZM\Console\Console;
use ZM\Event\SwooleEvent;
use ZM\Utils\DataProvider;
/**
* Class OnShutdown
* @package ZM\Event\SwooleEvent
* @SwooleHandler("shutdown")
*/
class OnShutdown implements SwooleEvent
{
public function onCall(Server $server) {
Console::verbose("正在关闭 Master 进程pid=" . posix_getpid());
$pid_path = DataProvider::getWorkingDir() . "/.daemon_pid";
if (file_exists($pid_path)) {
unlink($pid_path);
}
}
}