Do not send ParticipantLeft webhook event unless connected successfully. (#1234)

Fixes #1130
This commit is contained in:
David Zhao
2022-12-18 17:37:55 -08:00
committed by GitHub
parent dc3f566f1a
commit 33902a9f2a
9 changed files with 141 additions and 109 deletions
@@ -49,12 +49,13 @@ type FakeTelemetryService struct {
arg4 *livekit.ClientInfo
arg5 *livekit.AnalyticsClientMeta
}
ParticipantLeftStub func(context.Context, *livekit.Room, *livekit.ParticipantInfo)
ParticipantLeftStub func(context.Context, *livekit.Room, *livekit.ParticipantInfo, bool)
participantLeftMutex sync.RWMutex
participantLeftArgsForCall []struct {
arg1 context.Context
arg2 *livekit.Room
arg3 *livekit.ParticipantInfo
arg4 bool
}
RoomEndedStub func(context.Context, *livekit.Room)
roomEndedMutex sync.RWMutex
@@ -334,18 +335,19 @@ func (fake *FakeTelemetryService) ParticipantJoinedArgsForCall(i int) (context.C
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5
}
func (fake *FakeTelemetryService) ParticipantLeft(arg1 context.Context, arg2 *livekit.Room, arg3 *livekit.ParticipantInfo) {
func (fake *FakeTelemetryService) ParticipantLeft(arg1 context.Context, arg2 *livekit.Room, arg3 *livekit.ParticipantInfo, arg4 bool) {
fake.participantLeftMutex.Lock()
fake.participantLeftArgsForCall = append(fake.participantLeftArgsForCall, struct {
arg1 context.Context
arg2 *livekit.Room
arg3 *livekit.ParticipantInfo
}{arg1, arg2, arg3})
arg4 bool
}{arg1, arg2, arg3, arg4})
stub := fake.ParticipantLeftStub
fake.recordInvocation("ParticipantLeft", []interface{}{arg1, arg2, arg3})
fake.recordInvocation("ParticipantLeft", []interface{}{arg1, arg2, arg3, arg4})
fake.participantLeftMutex.Unlock()
if stub != nil {
fake.ParticipantLeftStub(arg1, arg2, arg3)
fake.ParticipantLeftStub(arg1, arg2, arg3, arg4)
}
}
@@ -355,17 +357,17 @@ func (fake *FakeTelemetryService) ParticipantLeftCallCount() int {
return len(fake.participantLeftArgsForCall)
}
func (fake *FakeTelemetryService) ParticipantLeftCalls(stub func(context.Context, *livekit.Room, *livekit.ParticipantInfo)) {
func (fake *FakeTelemetryService) ParticipantLeftCalls(stub func(context.Context, *livekit.Room, *livekit.ParticipantInfo, bool)) {
fake.participantLeftMutex.Lock()
defer fake.participantLeftMutex.Unlock()
fake.ParticipantLeftStub = stub
}
func (fake *FakeTelemetryService) ParticipantLeftArgsForCall(i int) (context.Context, *livekit.Room, *livekit.ParticipantInfo) {
func (fake *FakeTelemetryService) ParticipantLeftArgsForCall(i int) (context.Context, *livekit.Room, *livekit.ParticipantInfo, bool) {
fake.participantLeftMutex.RLock()
defer fake.participantLeftMutex.RUnlock()
argsForCall := fake.participantLeftArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}
func (fake *FakeTelemetryService) RoomEnded(arg1 context.Context, arg2 *livekit.Room) {