Skip to content

Commit 4aad0f3

Browse files
committed
Infer from timestamps if the LiveKit room has actually been created and adapt logging.
1 parent c280b23 commit 4aad0f3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ func (h *Handler) handle(w http.ResponseWriter, r *http.Request) {
259259

260260
if isFullAccessUser {
261261
roomClient := lksdk.NewRoomServiceClient(h.lkUrl, h.key, h.secret)
262+
creationStart := time.Now().Unix()
262263
room, err := roomClient.CreateRoom(
263264
context.Background(), &livekit.CreateRoomRequest{
264265
Name: sfuAccessRequest.Room,
@@ -282,7 +283,10 @@ func (h *Handler) handle(w http.ResponseWriter, r *http.Request) {
282283
return
283284
}
284285

285-
log.Printf("Created LiveKit room sid: %s (alias: %s) for local Matrix user %s (LiveKit identity: %s)", room.Sid, sfuAccessRequest.Room, userInfo.Sub , lkIdentity)
286+
// Log the room creation time and the user info
287+
if room.GetCreationTime() >= creationStart && room.GetCreationTime() <= time.Now().Unix() {
288+
log.Printf("Created LiveKit room sid: %s (alias: %s) for local Matrix user %s (LiveKit identity: %s)", room.Sid, sfuAccessRequest.Room, userInfo.Sub , lkIdentity)
289+
}
286290
}
287291

288292
res := SFUResponse{URL: h.lkUrl, JWT: token}

0 commit comments

Comments
 (0)