Update transport stats only when advancedMode is on

auto_join_3.3
Roman Drozd 2020-05-20 00:12:33 +02:00
parent 014c805530
commit 3fc8f5683e
2 changed files with 29 additions and 22 deletions

View File

@ -260,9 +260,6 @@ export default class RoomClient
this._startKeyListener();
this._startDevicesListener();
this._getTransportStats();
}
close()
@ -626,8 +623,6 @@ export default class RoomClient
async _getTransportStats()
{
try
{
setInterval(async () =>
{
if (this._recvTransport)
{
@ -648,8 +643,6 @@ export default class RoomClient
store.dispatch(
transportActions.addTransportStats(send, 'send'));
}
}, 1000);
}
catch (error)
{

View File

@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import { connect } from 'react-redux';
import {
meProducersSelector,
@ -334,6 +334,20 @@ const Me = (props) =>
);
}
useEffect(() =>
{
let poll;
const interval = 1000;
if (advancedMode)
{
poll = setInterval(() => roomClient._getTransportStats(), interval);
}
return () => clearInterval(poll);
}, [ roomClient, advancedMode ]);
return (
<React.Fragment>
<div