mirror of
https://github.com/livekit/livekit.git
synced 2026-08-27 22:34:25 +00:00
Prevent stats update if the deltas are empty (#619)
* Prevent stats update if the deltas are empty * increase force interval * static check * Change max delay to 30 seconds
This commit is contained in:
@@ -10,7 +10,10 @@ import (
|
||||
"github.com/livekit/protocol/utils"
|
||||
)
|
||||
|
||||
const livekitNamespace string = "livekit"
|
||||
const (
|
||||
livekitNamespace string = "livekit"
|
||||
forceUpdateInterval int64 = 15
|
||||
)
|
||||
|
||||
var (
|
||||
MessageCounter *prometheus.CounterVec
|
||||
@@ -66,6 +69,15 @@ func GetUpdatedNodeStats(prev *livekit.NodeStats) (*livekit.NodeStats, error) {
|
||||
packetsOutNow := packetsOut.Load()
|
||||
nackTotalNow := nackTotal.Load()
|
||||
|
||||
if bytesInNow == prev.BytesIn &&
|
||||
bytesOutNow == prev.BytesOut &&
|
||||
packetsInNow == prev.PacketsIn &&
|
||||
packetsOutNow == prev.PacketsOut &&
|
||||
nackTotalNow == prev.NackTotal &&
|
||||
elapsed < forceUpdateInterval {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return &livekit.NodeStats{
|
||||
StartedAt: prev.StartedAt,
|
||||
UpdatedAt: updatedAt,
|
||||
|
||||
Reference in New Issue
Block a user