Compare commits

...

4 Commits

Author SHA1 Message Date
刘祥超
c161d84fdf 版本号变更为0.6.4.2 2023-03-16 08:59:46 +08:00
刘祥超
495b553285 修复存储空间统计可能为负值的问题 2023-03-16 08:59:35 +08:00
刘祥超
21b770ba8b 修复运行测试用例时init()无法起作用的Bug 2023-03-13 21:49:41 +08:00
刘祥超
e9f94e0767 改进README.md 2023-03-13 08:56:18 +08:00
4 changed files with 23 additions and 4 deletions

View File

@@ -1 +1,2 @@
* `global.yaml` - 全局配置 * `api.template.yaml` - API相关配置模板
* `cluster.template.yaml` - 通过集群自动接入节点模板

View File

@@ -177,10 +177,15 @@ func (this *Manager) TotalDiskSize() int64 {
this.locker.RLock() this.locker.RLock()
defer this.locker.RUnlock() defer this.locker.RUnlock()
total := int64(0) var total = int64(0)
for _, storage := range this.storageMap { for _, storage := range this.storageMap {
total += storage.TotalDiskSize() total += storage.TotalDiskSize()
} }
if total < 0 {
total = 0
}
return total return total
} }

View File

@@ -1,7 +1,7 @@
package teaconst package teaconst
const ( const (
Version = "0.6.4" Version = "0.6.4.2"
ProductName = "Edge Node" ProductName = "Edge Node"
ProcessName = "edge-node" ProcessName = "edge-node"

View File

@@ -5,6 +5,7 @@ package teaconst
import ( import (
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
"os" "os"
"strings"
) )
var ( var (
@@ -15,7 +16,7 @@ var (
NodeId int64 = 0 NodeId int64 = 0
NodeIdString = "" NodeIdString = ""
IsMain = len(os.Args) == 1 || (len(os.Args) >= 2 && os.Args[1] == "pprof") IsMain = checkMain()
GlobalProductName = nodeconfigs.DefaultProductName GlobalProductName = nodeconfigs.DefaultProductName
@@ -24,3 +25,15 @@ var (
DiskIsFast = false // 是否为高速硬盘 DiskIsFast = false // 是否为高速硬盘
) )
// 检查是否为主程序
func checkMain() bool {
if len(os.Args) == 1 ||
(len(os.Args) >= 2 && os.Args[1] == "pprof") {
return true
}
exe, _ := os.Executable()
return strings.HasSuffix(exe, ".test") ||
strings.HasSuffix(exe, ".test.exe") ||
strings.Contains(exe, "___")
}