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

View file

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