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