From 54e7069a20b06d0886b589d1fe76caf215a282de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 14 Oct 2020 11:21:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Process/ServerInotify.php | 1 + System/Snowflake.php | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/System/Process/ServerInotify.php b/System/Process/ServerInotify.php index a3583bb8..90921a51 100644 --- a/System/Process/ServerInotify.php +++ b/System/Process/ServerInotify.php @@ -177,6 +177,7 @@ class ServerInotify extends Process /** * 重启 + * @throws Exception */ public function trigger_reload() { diff --git a/System/Snowflake.php b/System/Snowflake.php index d6077863..6b383dca 100644 --- a/System/Snowflake.php +++ b/System/Snowflake.php @@ -223,6 +223,16 @@ class Snowflake } + /** + * @return false|string + * @throws Exception + */ + public static function getMasterPid() + { + return file_get_contents(storage('socket.sock')); + } + + /** * @param int $fd * @param $data @@ -324,10 +334,11 @@ class Snowflake /** * @return mixed + * @throws Exception */ public static function reload() { - return Snowflake::app()->server->getServer()->reload(); + return Process::kill(Snowflake::getMasterPid(), SIGUSR1); }