replace entire nodeStats object (#393)
This commit is contained in:
@@ -462,9 +462,13 @@ func (r *RedisRouter) handleRTCMessage(rm *livekit.RTCNodeMessage) error {
|
||||
break
|
||||
}
|
||||
|
||||
if err := prometheus.UpdateCurrentNodeStats(r.currentNode.Stats); err != nil {
|
||||
updated, err := prometheus.GetUpdatedNodeStats(r.currentNode.Stats)
|
||||
if err != nil {
|
||||
logger.Errorw("could not update node stats", err)
|
||||
} else {
|
||||
r.currentNode.Stats = updated
|
||||
}
|
||||
|
||||
// TODO: check stats against config.Limit values
|
||||
if err := r.RegisterNode(); err != nil {
|
||||
logger.Errorw("could not update node", err)
|
||||
|
||||
@@ -19,11 +19,12 @@ func (s *SystemLoadSelector) filterNodes(nodes []*livekit.Node) ([]*livekit.Node
|
||||
|
||||
nodesLowLoad := make([]*livekit.Node, 0)
|
||||
for _, node := range nodes {
|
||||
numCpus := node.Stats.NumCpus
|
||||
stats := node.Stats
|
||||
numCpus := stats.NumCpus
|
||||
if numCpus == 0 {
|
||||
numCpus = 1
|
||||
}
|
||||
if node.Stats.LoadAvgLast1Min/float32(numCpus) < s.SysloadLimit {
|
||||
if stats.LoadAvgLast1Min/float32(numCpus) < s.SysloadLimit {
|
||||
nodesLowLoad = append(nodesLowLoad, node)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user