From 11c9c56a4d0d5e18ca8072cb61acac81209cddfa Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Tue, 17 Oct 2023 11:37:34 +0530 Subject: [PATCH] Defer close of source and sink to prevent error logs. (#2149) When a room is created via room service, when `StartSession` runs, it sees a closed request source and returns an error and that gets logged. It is not a real error. Defer the sink and source close so that room creation can finish without errors. --- pkg/service/roomservice.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/service/roomservice.go b/pkg/service/roomservice.go index c81274093..d59d3ce82 100644 --- a/pkg/service/roomservice.go +++ b/pkg/service/roomservice.go @@ -84,8 +84,8 @@ func (s *RoomService) CreateRoom(ctx context.Context, req *livekit.CreateRoomReq if err != nil { return nil, err } - sink.Close() - source.Close() + defer sink.Close() + defer source.Close() // ensure it's created correctly err = s.confirmExecution(func() error {