在初始化时即获取CPU数量

This commit is contained in:
刘祥超
2021-01-25 19:40:57 +08:00
parent 50b7d9c51f
commit 3b22a800f6
2 changed files with 2 additions and 2 deletions

View File

@@ -108,7 +108,7 @@ func (this *NodeStatusExecutor) updateCPU(status *nodeconfigs.NodeStatus) {
}
status.CPUUsage = percents[0] / 100
if time.Since(this.cpuUpdatedTime) > 300*time.Second { // 每隔5分钟才会更新一次
if this.cpuLogicalCount == 0 && this.cpuPhysicalCount == 0 {
this.cpuUpdatedTime = time.Now()
status.CPULogicalCount, err = cpu.Counts(true)