完善日志等级
Some checks failed
build / build (api, amd64, linux) (push) Failing after -50s
build / build (api, arm64, linux) (push) Failing after -51s
build / build (api.exe, amd64, windows) (push) Failing after -51s

This commit is contained in:
CN-JS-HuiBai
2026-04-18 02:23:36 +08:00
parent f4872bd12e
commit 8cf8bd6724
3 changed files with 21 additions and 4 deletions

View File

@@ -582,6 +582,20 @@ func serializeAdminServer(server model.Server, groups map[int]model.ServerGroup,
isOnline = 2
}
// Inherit status from parent if current node is offline
if isOnline == 0 && server.ParentID != nil {
if parentServer, ok := servers[*server.ParentID]; ok {
pLastCheckAt, _ := database.CacheGetJSON[int64](nodeLastCheckKey(&parentServer))
pLastPushAt, _ := database.CacheGetJSON[int64](nodeLastPushKey(&parentServer))
if pLastCheckAt > 0 && now-pLastCheckAt <= 300 {
isOnline = 1
}
if pLastPushAt > 0 && now-pLastPushAt <= 300 {
isOnline = 2
}
}
}
availableStatus := 0
if isOnline == 1 {
availableStatus = 1