Send participant_connection_aborted when participant session is closed (#3848)
* Send `participant_connection_aborted` when participant session is closed without becoming `ACTIVE`. There is one sticky case. If there is a migration and the migration fails, this will send `participant_connection_aborted` even though the participant may have connected properly on the previous node. * depsg
This commit is contained in:
+10
-4
@@ -112,7 +112,7 @@ func (t *telemetryService) ParticipantActive(
|
||||
) {
|
||||
t.enqueue(func() {
|
||||
if !isMigration {
|
||||
// consider participant joined only when they became active
|
||||
// a participant is considered "joined" only when they become "active"
|
||||
t.NotifyEvent(ctx, &livekit.WebhookEvent{
|
||||
Event: webhook.EventParticipantJoined,
|
||||
Room: room,
|
||||
@@ -190,14 +190,20 @@ func (t *telemetryService) ParticipantLeft(ctx context.Context,
|
||||
}
|
||||
}
|
||||
|
||||
if isConnected && shouldSendEvent {
|
||||
if shouldSendEvent {
|
||||
webhookEvent := webhook.EventParticipantLeft
|
||||
analyticsEvent := livekit.AnalyticsEventType_PARTICIPANT_LEFT
|
||||
if !isConnected {
|
||||
webhookEvent = webhook.EventParticipantConnectionAborted
|
||||
analyticsEvent = livekit.AnalyticsEventType_PARTICIPANT_CONNECTION_ABORTED
|
||||
}
|
||||
t.NotifyEvent(ctx, &livekit.WebhookEvent{
|
||||
Event: webhook.EventParticipantLeft,
|
||||
Event: webhookEvent,
|
||||
Room: room,
|
||||
Participant: participant,
|
||||
})
|
||||
|
||||
t.SendEvent(ctx, newParticipantEvent(livekit.AnalyticsEventType_PARTICIPANT_LEFT, room, participant))
|
||||
t.SendEvent(ctx, newParticipantEvent(analyticsEvent, room, participant))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user