Delta stats throughout (#615)

* Use delta stats throughout and avoid calculating deltas in telemetry

* Fix a few things after testing

* Remove debug

* Fix tests

* delete instead of setting to nil

* Point to the latest protocol
This commit is contained in:
Raja Subramanian
2022-04-16 21:11:32 +05:30
committed by GitHub
parent 7a3e446a65
commit a98d955284
15 changed files with 506 additions and 581 deletions
+7 -7
View File
@@ -6,22 +6,22 @@ import (
"github.com/livekit/protocol/logger"
)
const (
MaxOps = 50
)
type OpsQueue struct {
logger logger.Logger
name string
size int
lock sync.RWMutex
ops chan func()
isStopped bool
}
func NewOpsQueue(logger logger.Logger) *OpsQueue {
func NewOpsQueue(logger logger.Logger, name string, size int) *OpsQueue {
return &OpsQueue{
logger: logger,
ops: make(chan func(), MaxOps),
name: name,
size: size,
ops: make(chan func(), size),
}
}
@@ -55,7 +55,7 @@ func (oq *OpsQueue) Enqueue(op func()) {
select {
case oq.ops <- op:
default:
oq.logger.Warnw("ops queue full", nil)
oq.logger.Warnw("ops queue full", nil, "name", oq.name, "size", oq.size)
}
oq.lock.RUnlock()
}