Fix SubParticipant twice when paticipant left (#2672)
This commit is contained in:
@@ -161,18 +161,14 @@ func (t *telemetryService) ParticipantLeft(ctx context.Context,
|
||||
) {
|
||||
t.enqueue(func() {
|
||||
isConnected := false
|
||||
hasWorker := false
|
||||
if worker, ok := t.getWorker(livekit.ParticipantID(participant.Sid)); ok {
|
||||
hasWorker = true
|
||||
isConnected = worker.IsConnected()
|
||||
if worker.ClosedAt().IsZero() {
|
||||
prometheus.SubParticipant()
|
||||
}
|
||||
worker.Close()
|
||||
}
|
||||
|
||||
if hasWorker {
|
||||
// signifies we had incremented participant count
|
||||
prometheus.SubParticipant()
|
||||
}
|
||||
|
||||
if isConnected && shouldSendEvent {
|
||||
t.NotifyEvent(ctx, &livekit.WebhookEvent{
|
||||
Event: webhook.EventParticipantLeft,
|
||||
|
||||
Reference in New Issue
Block a user