From 770076febf0bf022593d767f3e23f7a50cebeb17 Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Thu, 18 Aug 2022 12:46:18 +0800 Subject: [PATCH] fix resume/restart with single node mode (#930) * fix resume/restart with single node mode * clean comment --- pkg/rtc/participant.go | 2 +- pkg/service/roommanager.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index 4e8ed4e09..fc1c53d81 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -576,12 +576,12 @@ func (p *ParticipantImpl) Start() { } func (p *ParticipantImpl) Close(sendLeave bool, reason types.ParticipantCloseReason) error { + p.params.Logger.Infow("try close participant", "sendLeave", sendLeave, "reason", reason.String()) if p.isClosed.Swap(true) { // already closed return nil } - p.params.Logger.Infow("closing participant", "sendLeave", sendLeave, "reason", reason.String()) // send leave message if sendLeave { _ = p.writeMessage(&livekit.SignalResponse{ diff --git a/pkg/service/roommanager.go b/pkg/service/roommanager.go index ccf5efb33..224c4724a 100644 --- a/pkg/service/roommanager.go +++ b/pkg/service/roommanager.go @@ -415,9 +415,6 @@ func (r *RoomManager) getOrCreateRoom(ctx context.Context, roomName livekit.Room // manages an RTC session for a participant, runs on the RTC node func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.LocalParticipant, requestSource routing.MessageSource) { defer func() { - // give time for the participant to be closed with a proper reason. - // if participant is closed from here, we would be obscuring the real reason the participant is closed. - time.Sleep(2 * time.Second) logger.Infow("RTC session finishing", "participant", participant.Identity(), "pID", participant.ID(),