From 87e71d3650a09ca7379b710f227148fe632d15f2 Mon Sep 17 00:00:00 2001 From: dosse91 Date: Sun, 27 Sep 2020 20:18:21 +0200 Subject: [PATCH] Merged with master --- speedtest.js | 4 ++-- speedtest_worker.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/speedtest.js b/speedtest.js index a11f456..6a85a8d 100644 --- a/speedtest.js +++ b/speedtest.js @@ -330,13 +330,13 @@ Speedtest.prototype = { console.error("Speedtest onupdate event threw exception: " + e); } if (data.testState >= 4) { + clearInterval(this.updater); + this._state = 4; try { if (this.onend) this.onend(data.testState == 5); } catch (e) { console.error("Speedtest onend event threw exception: " + e); } - clearInterval(this.updater); - this._state = 4; } }.bind(this); this.updater = setInterval( diff --git a/speedtest_worker.js b/speedtest_worker.js index 5d518d1..3ff26d6 100644 --- a/speedtest_worker.js +++ b/speedtest_worker.js @@ -403,8 +403,8 @@ function dlTest(done) { var speed = totLoaded / (t / 1000.0); if (settings.time_auto) { //decide how much to shorten the test. Every 200ms, the test is shortened by the bonusT calculated here - var bonus = (6.4 * speed) / 100000; - bonusT += bonus > 800 ? 800 : bonus; + var bonus = (5.0 * speed) / 100000; + bonusT += bonus > 400 ? 400 : bonus; } //update status dlStatus = ((speed * 8 * settings.overheadCompensationFactor) / (settings.useMebibits ? 1048576 : 1000000)).toFixed(2); // speed is multiplied by 8 to go from bytes to bits, overhead compensation is applied, then everything is divided by 1048576 or 1000000 to go to megabits/mebibits @@ -551,8 +551,8 @@ function ulTest(done) { var speed = totLoaded / (t / 1000.0); if (settings.time_auto) { //decide how much to shorten the test. Every 200ms, the test is shortened by the bonusT calculated here - var bonus = (6.4 * speed) / 100000; - bonusT += bonus > 800 ? 800 : bonus; + var bonus = (5.0 * speed) / 100000; + bonusT += bonus > 400 ? 400 : bonus; } //update status ulStatus = ((speed * 8 * settings.overheadCompensationFactor) / (settings.useMebibits ? 1048576 : 1000000)).toFixed(2); // speed is multiplied by 8 to go from bytes to bits, overhead compensation is applied, then everything is divided by 1048576 or 1000000 to go to megabits/mebibits