Improve panic recovery to use participant logger. (#1375)

Also made IssueFullReconnect public
This commit is contained in:
David Zhao
2023-02-02 14:55:50 -08:00
committed by GitHub
parent 501fb0860e
commit be4764b93b
6 changed files with 58 additions and 21 deletions
+5 -11
View File
@@ -468,23 +468,17 @@ 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() {
logger.Debugw("RTC session finishing",
"participant", participant.Identity(),
"pID", participant.ID(),
"room", room.Name(),
"roomID", room.ID(),
)
requestSource.Close()
}()
defer rtc.Recover()
pLogger := rtc.LoggerWithParticipant(
rtc.LoggerWithRoom(logger.GetLogger(), room.Name(), room.ID()),
participant.Identity(),
participant.ID(),
false,
)
defer func() {
pLogger.Debugw("RTC session finishing")
requestSource.Close()
}()
defer rtc.Recover(pLogger)
// send first refresh for cases when client token is close to expiring
_ = r.refreshToken(participant)
+1 -1
View File
@@ -261,7 +261,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// we would terminate the signal connection as well
_ = conn.Close()
}()
defer rtc.Recover()
defer rtc.Recover(pLogger)
for {
select {
case <-done: