完善日志等级
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user