Skip to content

Commit 8b71ce3

Browse files
committed
fix: send rtc metrics at the beginning every 5 seconds, then every 30 seconds
1 parent ad8d241 commit 8b71ce3

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

packages/@webex/plugin-meetings/src/meeting/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -3213,7 +3213,8 @@ export default class Meeting extends StatelessWebexPlugin {
32133213
options: {meetingId: this.id},
32143214
});
32153215
}
3216-
this.rtcMetrics?.sendNextMetrics();
3216+
const numberOfReportsToSend = 30000 / 5000; // 30 seconds divided by 5 seconds
3217+
this.rtcMetrics?.sendNextMetrics(numberOfReportsToSend);
32173218
this.updateLLMConnection();
32183219
});
32193220

packages/@webex/plugin-meetings/src/rtcMetrics/index.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default class RtcMetrics {
3434

3535
connectionId: string;
3636

37-
shouldSendMetricsOnNextStatsReport: boolean;
37+
shouldSendMetricsOnNextStatsReport: number;
3838

3939
/**
4040
* Initialize the interval.
@@ -70,10 +70,11 @@ export default class RtcMetrics {
7070
* This is useful for cases when something important happens that affects the media connection,
7171
* for example when we move from lobby into the meeting.
7272
*
73+
* @param {number} n - The number of next N metrics reports to send.
7374
* @returns {void}
7475
*/
75-
public sendNextMetrics() {
76-
this.shouldSendMetricsOnNextStatsReport = true;
76+
public sendNextMetrics(n = 1) {
77+
this.shouldSendMetricsOnNextStatsReport = n;
7778
}
7879

7980
/**
@@ -95,7 +96,7 @@ export default class RtcMetrics {
9596
// this is the first useful set of data (WCME gives it to us after 5s), send it out immediately
9697
// in case the user is unhappy and closes the browser early
9798
this.sendMetricsInQueue();
98-
this.shouldSendMetricsOnNextStatsReport = false;
99+
this.shouldSendMetricsOnNextStatsReport -= 1;
99100
}
100101

101102
try {
@@ -151,7 +152,7 @@ export default class RtcMetrics {
151152
*/
152153
private resetConnection() {
153154
this.connectionId = uuid.v4();
154-
this.shouldSendMetricsOnNextStatsReport = true;
155+
this.shouldSendMetricsOnNextStatsReport = 1;
155156
}
156157

157158
/**

0 commit comments

Comments
 (0)