use a 1mb file for calculating bandwidth

This commit is contained in:
Anthony 2021-09-27 16:43:26 +03:00
parent 1e7c2c26a2
commit 1cc591b247
No known key found for this signature in database
GPG key ID: C386D3C93D50E356
2 changed files with 5 additions and 4 deletions

View file

@ -17,8 +17,8 @@ async function getUserBandwidth() {
userDownloadBandwidthInBitsPerSecond = await getConnectionSpeed();
}
getUserBandwidth();
setInterval(getUserBandwidth, 1000 * 30);
// get user bandwidth every minute, starting after an initial one minute wait
setInterval(getUserBandwidth, 1000 * 60);
const isProduction = process.env.NODE_ENV === 'production';
const devInternalApis = process.env.LBRY_API_URL && process.env.LBRY_API_URL.includes('dev');
@ -136,6 +136,7 @@ async function sendAndResetWatchmanData() {
let timeSinceLastIntervalSend = new Date() - lastSentTime;
lastSentTime = new Date();
// TODO: hook into here to calculate bandwidth
let protocol;
if (videoType === 'application/x-mpegURL') {
protocol = 'hls';

View file

@ -1,5 +1,5 @@
const imageAddr = 'https://upload.wikimedia.org/wikipedia/commons/a/a6/Brandenburger_Tor_abends.jpg';
const downloadSize = 2707459; // this must match with the image above
const imageAddr = 'https://upload.wikimedia.org/wikipedia/commons/b/b9/Pizigani_1367_Chart_1MB.jpg';
const downloadSize = 1093957; // this must match with the image above
let startTime, endTime;
async function measureConnectionSpeed() {