list-nodes command action (#87)

* list-nodes command action

* refactor stats into a package

* store existing stats in redis, more refactoring

* dz review: atomic load
This commit is contained in:
Mathew Kamkar
2021-08-24 10:14:39 -07:00
committed by GitHub
parent a8b0125e42
commit f5466c74e6
15 changed files with 428 additions and 294 deletions
+3 -3
View File
@@ -8,10 +8,10 @@ import (
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
"github.com/livekit/protocol/utils"
"github.com/livekit/livekit-server/pkg/logger"
"github.com/livekit/livekit-server/pkg/utils/stats"
livekit "github.com/livekit/livekit-server/proto"
"github.com/livekit/protocol/utils"
)
const (
@@ -309,7 +309,7 @@ func (r *RedisRouter) statsWorker() {
// update periodically seconds
select {
case <-time.After(statsUpdateInterval):
r.currentNode.Stats.UpdatedAt = time.Now().Unix()
stats.UpdateCurrentNodeStats(r.currentNode.Stats)
if err := r.RegisterNode(); err != nil {
logger.Errorw("could not update node", err, "nodeID", r.currentNode.Id)
}