From 443fb992699818305e3d7f6885ca7d1d36fbe7cd Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 01 十一月 2023 15:47:57 +0800 Subject: [PATCH] 增加系统运行时间,系统状态,集群状态,集群节点数 --- crontask/cron_task.go | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/crontask/cron_task.go b/crontask/cron_task.go index 230d38e..66ddf9b 100644 --- a/crontask/cron_task.go +++ b/crontask/cron_task.go @@ -7,6 +7,7 @@ "apsClient/nsq" "apsClient/pkg/ecode" "apsClient/pkg/logx" + "apsClient/serf" "apsClient/service" "fmt" "github.com/go-co-op/gocron" @@ -79,6 +80,9 @@ s.Every(60).Seconds().Do(SyncProductionProgress) //鍚屾鐢熶骇鏁版嵁 s.Every(30).Seconds().Do(SyncTaskStatus) //鍚屾浠诲姟鐘舵�� } + + s.Every(10).Seconds().Do(QueryClusterStatus) //鏌ヨ闆嗙兢鑺傜偣鏁伴噺 + s.StartAsync() return nil } @@ -152,3 +156,9 @@ logx.Errorf("send pull data msg error:%v, msg:%+v", err.Error(), msg) } } + +func QueryClusterStatus() { + clusterStatus, nodeQuantity := serf.QueryClusterStatusAndNodeQuantity() + conf.Conf.SerfClusterStatus = clusterStatus + conf.Conf.ClusterNodeQuantity = nodeQuantity +} -- Gitblit v1.8.0