End spans when calls are replaced by a different call

This commit is contained in:
David Baker 2023-04-24 17:57:05 +01:00
parent 060a50d27a
commit 32476571fb

View file

@ -210,7 +210,12 @@ export class OTelGroupCallMembership {
for (const callTrackingInfo of this.callsByCallId.values()) {
const userCalls = calls.get(callTrackingInfo.userId);
if (!userCalls || !userCalls.has(callTrackingInfo.deviceId)) {
if (
!userCalls ||
!userCalls.has(callTrackingInfo.deviceId) ||
userCalls.get(callTrackingInfo.deviceId).callId !==
callTrackingInfo.call.callId
) {
callTrackingInfo.span.end();
this.callsByCallId.delete(callTrackingInfo.call.callId);
}