From 9dfe04551430eb1da5fe1a1a84f5a9cc7b332b60 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Thu, 5 Jan 2023 02:06:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E5=90=8C=E6=97=B6=20?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E8=8A=82=E7=82=B9=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Support/Cluster.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Support/Cluster.php b/app/Support/Cluster.php index 0427235..308ada7 100644 --- a/app/Support/Cluster.php +++ b/app/Support/Cluster.php @@ -36,6 +36,8 @@ public static function publish($event, $data = []): void ], 'data' => $data, ])); + + self::registerThisNode(); } /** @@ -100,7 +102,7 @@ public static function hget($key, $value, $default = null): string|array|null return Redis::hget($key, $value, $default); } - public static function registerThisNode(): void + public static function registerThisNode($report = true): void { $node_id = config('settings.node.id'); @@ -112,6 +114,8 @@ public static function registerThisNode(): void 'last_heartbeat' => time(), ]); - Cluster::publish('node.ok'); + if ($report) { + Cluster::publish('node.ok'); + } } }