Skip to content

Commit

Permalink
fix: send rtc metrics at the beginning every 5 seconds, then every 30…
Browse files Browse the repository at this point in the history
… seconds
  • Loading branch information
kwasniow committed Oct 9, 2024
1 parent ad8d241 commit 52f0ecb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/@webex/plugin-meetings/src/meeting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3213,7 +3213,8 @@ export default class Meeting extends StatelessWebexPlugin {
options: {meetingId: this.id},
});
}
this.rtcMetrics?.sendNextMetrics();
const numberOfReportsToSend = 30000 / 5000; // 25 seconds divided by 5 seconds
this.rtcMetrics?.sendNextMetrics(numberOfReportsToSend);
this.updateLLMConnection();
});

Expand Down
11 changes: 6 additions & 5 deletions packages/@webex/plugin-meetings/src/rtcMetrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class RtcMetrics {

connectionId: string;

shouldSendMetricsOnNextStatsReport: boolean;
shouldSendMetricsOnNextStatsReport: number;

/**
* Initialize the interval.
Expand Down Expand Up @@ -70,10 +70,11 @@ export default class RtcMetrics {
* This is useful for cases when something important happens that affects the media connection,
* for example when we move from lobby into the meeting.
*
* @param {number} n - The number of next N metrics reports to send.
* @returns {void}
*/
public sendNextMetrics() {
this.shouldSendMetricsOnNextStatsReport = true;
public sendNextMetrics(n = 1) {
this.shouldSendMetricsOnNextStatsReport = n;
}

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

try {
Expand Down Expand Up @@ -151,7 +152,7 @@ export default class RtcMetrics {
*/
private resetConnection() {
this.connectionId = uuid.v4();
this.shouldSendMetricsOnNextStatsReport = true;
this.shouldSendMetricsOnNextStatsReport = 6;
}

/**
Expand Down

0 comments on commit 52f0ecb

Please sign in to comment.