Add some documentation

This commit is contained in:
2024-02-20 13:52:54 +01:00
parent 8c0e38349a
commit 47028f85b8
2 changed files with 10 additions and 10 deletions

View File

@@ -20,10 +20,12 @@ import Speedtest from "./Speedtest.svelte";
</p> </p>
<p> <p>
The speed measured is the maximum speed reached for two continuous 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 during the test. The normal test has a time limit of 15
seconds and the long test 60 seconds. When the maximum speed has not seconds and the long test 30 seconds. When the maximum speed has not
changed for a third of the test duration (10 or 20 seconds) the test changed for a third of the test duration (5 or 10 seconds) the test
will end and the result will be final. 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.
</p> </p>
<p> <p>
The speed gauge uses a logarithmic scale, which means that each The speed gauge uses a logarithmic scale, which means that each

View File

@@ -8,15 +8,13 @@ import { copy_text } from "../util/Util.svelte";
let running = false let running = false
let data_received = 0 let data_received = 0
const update_interval = 100 const update_interval = 100
let test_duration = 0
let latency = 0 let latency = 0
const start = async (dur = 6000) => { const start = async (dur = 10000) => {
if (running) { if (running) {
return return
} }
running = true running = true
test_duration = dur
data_received = 0 data_received = 0
const latency_start = Date.now() const latency_start = Date.now()
@@ -33,7 +31,7 @@ const start = async (dur = 6000) => {
const reader = req.body.getReader(); const reader = req.body.getReader();
measure_speed(() => reader.cancel(), test_duration) measure_speed(() => reader.cancel(), dur)
while(true) { while(true) {
const {done, value} = await reader.read() const {done, value} = await reader.read()
@@ -163,8 +161,8 @@ onMount(() => {
<section class="highlight_border"> <section class="highlight_border">
<div style="text-align: center"> <div style="text-align: center">
<Button icon="speed" label="Start test" click={() => start(30000)} disabled={running} highlight={!running}/> <Button icon="speed" label="Start test" click={() => start(15000)} disabled={running} highlight={!running}/>
<Button icon="speed" label="Long test" click={() => start(60000)} disabled={running}/> <Button icon="speed" label="Long test" click={() => start(30000)} disabled={running}/>
<Button <Button
highlight_on_click highlight_on_click
disabled={result_link === ""} disabled={result_link === ""}