mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-29 01:06:36 +08:00
统计节点分组中节点数量时判断节点集群是否存在
This commit is contained in:
@@ -432,9 +432,9 @@ func (this *NodeDAO) FindAllInactiveNodesWithClusterId(tx *dbs.Tx, clusterId int
|
||||
_, err = this.Query(tx).
|
||||
State(NodeStateEnabled).
|
||||
Attr("clusterId", clusterId).
|
||||
Attr("isOn", true). // 只监控启用的节点
|
||||
Attr("isOn", true). // 只监控启用的节点
|
||||
Attr("isInstalled", true). // 只监控已经安装的节点
|
||||
Attr("isActive", true). // 当前已经在线的
|
||||
Attr("isActive", true). // 当前已经在线的
|
||||
Where("(status IS NULL OR (JSON_EXTRACT(status, '$.isActive')=false AND UNIX_TIMESTAMP()-JSON_EXTRACT(status, '$.updatedAt')>10) OR UNIX_TIMESTAMP()-JSON_EXTRACT(status, '$.updatedAt')>120)").
|
||||
Result("id", "name").
|
||||
Slice(&result).
|
||||
@@ -941,6 +941,7 @@ func (this *NodeDAO) CountAllEnabledNodesWithGroupId(tx *dbs.Tx, groupId int64)
|
||||
return this.Query(tx).
|
||||
State(NodeStateEnabled).
|
||||
Attr("groupId", groupId).
|
||||
Where("clusterId IN (SELECT id FROM " + SharedNodeClusterDAO.Table + " WHERE state=1)").
|
||||
Count()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user