From 47028f85b8ea05769520cdc531c30877e3861df2 Mon Sep 17 00:00:00 2001 From: Fornax Date: Tue, 20 Feb 2024 13:52:54 +0100 Subject: [PATCH] Add some documentation --- svelte/src/speedtest/Index.svelte | 10 ++++++---- svelte/src/speedtest/Speedtest.svelte | 10 ++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/svelte/src/speedtest/Index.svelte b/svelte/src/speedtest/Index.svelte index 5531e14..912af04 100644 --- a/svelte/src/speedtest/Index.svelte +++ b/svelte/src/speedtest/Index.svelte @@ -20,10 +20,12 @@ import Speedtest from "./Speedtest.svelte";

The speed measured is the maximum speed reached for two continuous - seconds during the test. The normal test has a time limit of 30 - seconds and the long test 60 seconds. When the maximum speed has not - changed for a third of the test duration (10 or 20 seconds) the test - will end and the result will be final. + seconds during the test. The normal test has a time limit of 15 + seconds and the long test 30 seconds. When the maximum speed has not + changed for a third of the test duration (5 or 10 seconds) the test + will end and the result will be final. The long test will use much + more bandwidth, so if you're on a cap it's recommended to use the + normal test.

The speed gauge uses a logarithmic scale, which means that each diff --git a/svelte/src/speedtest/Speedtest.svelte b/svelte/src/speedtest/Speedtest.svelte index 03c7853..913adb4 100644 --- a/svelte/src/speedtest/Speedtest.svelte +++ b/svelte/src/speedtest/Speedtest.svelte @@ -8,15 +8,13 @@ import { copy_text } from "../util/Util.svelte"; let running = false let data_received = 0 const update_interval = 100 -let test_duration = 0 let latency = 0 -const start = async (dur = 6000) => { +const start = async (dur = 10000) => { if (running) { return } running = true - test_duration = dur data_received = 0 const latency_start = Date.now() @@ -33,7 +31,7 @@ const start = async (dur = 6000) => { const reader = req.body.getReader(); - measure_speed(() => reader.cancel(), test_duration) + measure_speed(() => reader.cancel(), dur) while(true) { const {done, value} = await reader.read() @@ -163,8 +161,8 @@ onMount(() => {

-