Move callbacks out of messageRouter (#269)

* move callbacks out of messageRouter

* OCD

* more OCD

* fix forwarder test

* even more OCD

* maximum OCD

* package name collision, copy lock by value
This commit is contained in:
David Colburn
2021-12-17 13:19:23 -08:00
committed by GitHub
parent a06edd885e
commit faa870de3d
82 changed files with 315 additions and 527 deletions
+4 -4
View File
@@ -3,7 +3,7 @@ package telemetry
import (
"context"
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/livekit-server/pkg/config"
@@ -24,14 +24,14 @@ type analyticsService struct {
stats livekit.AnalyticsRecorderService_IngestStatsClient
}
func NewAnalyticsService(conf *config.Config, currentNode routing.LocalNode) AnalyticsService {
func NewAnalyticsService(_ *config.Config, currentNode routing.LocalNode) AnalyticsService {
return &analyticsService{
analyticsKey: "", // TODO: conf.AnalyticsKey
nodeID: currentNode.Id,
}
}
func (a *analyticsService) SendStats(ctx context.Context, stats []*livekit.AnalyticsStat) {
func (a *analyticsService) SendStats(_ context.Context, stats []*livekit.AnalyticsStat) {
if a.stats == nil {
return
}
@@ -45,7 +45,7 @@ func (a *analyticsService) SendStats(ctx context.Context, stats []*livekit.Analy
}
}
func (a *analyticsService) SendEvent(ctx context.Context, event *livekit.AnalyticsEvent) {
func (a *analyticsService) SendEvent(_ context.Context, event *livekit.AnalyticsEvent) {
if a.events == nil {
return
}
+2 -2
View File
@@ -1,7 +1,7 @@
package telemetry
import (
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
"github.com/pion/interceptor"
"github.com/pion/rtcp"
)
@@ -20,7 +20,7 @@ type StatsInterceptorFactory struct {
identity string
}
func (f *StatsInterceptorFactory) NewInterceptor(id string) (interceptor.Interceptor, error) {
func (f *StatsInterceptorFactory) NewInterceptor(_ string) (interceptor.Interceptor, error) {
return &StatsInterceptor{
t: f.t,
participantID: f.participantID,
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"sync/atomic"
"time"
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/utils"
"github.com/prometheus/client_golang/prometheus"
)
+1 -1
View File
@@ -5,7 +5,7 @@ package prometheus
import (
linuxproc "github.com/c9s/goprocinfo/linux"
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
)
func updateCurrentNodeSystemStats(nodeStats *livekit.NodeStats) error {
+2 -2
View File
@@ -3,8 +3,8 @@
package prometheus
import livekit "github.com/livekit/protocol/livekit"
import "github.com/livekit/protocol/livekit"
func updateCurrentNodeSystemStats(nodeStats *livekit.NodeStats) error {
func updateCurrentNodeSystemStats(_ *livekit.NodeStats) error {
return nil
}
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"sync"
"time"
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
"google.golang.org/protobuf/types/known/timestamppb"
"github.com/livekit/livekit-server/pkg/sfu/buffer"
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"sync"
"github.com/gammazero/workerpool"
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/webhook"
"github.com/pion/rtcp"
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context"
"time"
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/webhook"
"google.golang.org/protobuf/types/known/timestamppb"
+5 -4
View File
@@ -5,10 +5,11 @@ import (
"testing"
"time"
"github.com/livekit/livekit-server/pkg/telemetry"
"github.com/livekit/livekit-server/pkg/telemetry/telemetryfakes"
"github.com/livekit/protocol/livekit"
"github.com/stretchr/testify/require"
"github.com/livekit/livekit-server/pkg/telemetry"
"github.com/livekit/livekit-server/pkg/telemetry/telemetryfakes"
)
type telemetryServiceFixture struct {
@@ -23,7 +24,7 @@ func createFixture() *telemetryServiceFixture {
return fixture
}
func Test_TelemetrySerice_Downstream_Stats(t *testing.T) {
func Test_TelemetryService_Downstream_Stats(t *testing.T) {
fixture := createFixture()
room := &livekit.Room{}
@@ -33,7 +34,7 @@ func Test_TelemetrySerice_Downstream_Stats(t *testing.T) {
totalBytes := 33
fixture.sut.OnDownstreamPacket(partSID, totalBytes)
//call participant left to trigget sending of analytics
// call participant left to trigget sending of analytics
fixture.sut.ParticipantLeft(context.Background(), room, participantInfo)
time.Sleep(time.Millisecond * 100) // wait for Update function to be called in go routine