Use monotonic time util. (#3112)

Thank you @paulwe for doing this. I was promising to do this for a
while, but just like other times, empty promises :-(
This commit is contained in:
Raja Subramanian
2024-10-17 10:49:24 +05:30
committed by GitHub
parent 19c5ed6343
commit 40b10af960
14 changed files with 23 additions and 117 deletions
-5
View File
@@ -66,8 +66,6 @@ type iceConfigCacheKey struct {
type RoomManager struct {
lock sync.RWMutex
baseTime time.Time
config *config.Config
rtcConfig *rtc.WebRTCConfig
serverInfo *livekit.ServerInfo
@@ -97,7 +95,6 @@ type RoomManager struct {
}
func NewLocalRoomManager(
baseTime time.Time,
conf *config.Config,
roomStore ObjectStore,
currentNode routing.LocalNode,
@@ -119,7 +116,6 @@ func NewLocalRoomManager(
}
r := &RoomManager{
baseTime: baseTime,
config: conf,
rtcConfig: rtcConf,
currentNode: currentNode,
@@ -449,7 +445,6 @@ func (r *RoomManager) StartSession(
subscriberAllowPause = *pi.SubscriberAllowPause
}
participant, err = rtc.NewParticipant(rtc.ParticipantParams{
BaseTime: r.baseTime,
Identity: pi.Identity,
Name: pi.Name,
SID: sid,
-6
View File
@@ -20,7 +20,6 @@ package service
import (
"fmt"
"os"
"time"
"github.com/google/wire"
"github.com/pion/turn/v2"
@@ -46,7 +45,6 @@ import (
func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*LivekitServer, error) {
wire.Build(
getTimeNow,
getNodeID,
createRedisClient,
createStore,
@@ -124,10 +122,6 @@ func InitializeRouter(conf *config.Config, currentNode routing.LocalNode) (routi
return nil, nil
}
func getTimeNow() time.Time {
return time.Now()
}
func getNodeID(currentNode routing.LocalNode) livekit.NodeID {
return livekit.NodeID(currentNode.Id)
}
+1 -7
View File
@@ -27,7 +27,6 @@ import (
"github.com/redis/go-redis/v9"
"gopkg.in/yaml.v3"
"os"
"time"
)
import (
@@ -125,7 +124,6 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
if err != nil {
return nil, err
}
time := getTimeNow()
clientConfigurationManager := createClientConfiguration()
client, err := agent.NewAgentClient(messageBus)
if err != nil {
@@ -135,7 +133,7 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
timedVersionGenerator := utils.NewDefaultTimedVersionGenerator()
turnAuthHandler := NewTURNAuthHandler(keyProvider)
forwardStats := createForwardStats(conf)
roomManager, err := NewLocalRoomManager(time, conf, objectStore, currentNode, router, roomAllocator, telemetryService, clientConfigurationManager, client, agentStore, rtcEgressLauncher, timedVersionGenerator, turnAuthHandler, messageBus, forwardStats)
roomManager, err := NewLocalRoomManager(conf, objectStore, currentNode, router, roomAllocator, telemetryService, clientConfigurationManager, client, agentStore, rtcEgressLauncher, timedVersionGenerator, turnAuthHandler, messageBus, forwardStats)
if err != nil {
return nil, err
}
@@ -184,10 +182,6 @@ func InitializeRouter(conf *config.Config, currentNode routing.LocalNode) (routi
// wire.go:
func getTimeNow() time.Time {
return time.Now()
}
func getNodeID(currentNode routing.LocalNode) livekit.NodeID {
return livekit.NodeID(currentNode.Id)
}