From 441142f26921510a049d6a8458026c7c6d962ca1 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 18 May 2025 15:11:00 +0200 Subject: fix a few live updating bugs --- scripts/dummy_worker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts/dummy_worker.ts') diff --git a/scripts/dummy_worker.ts b/scripts/dummy_worker.ts index 00e6ad2..1bbe0c7 100644 --- a/scripts/dummy_worker.ts +++ b/scripts/dummy_worker.ts @@ -4,7 +4,7 @@ const ws = new WebSocket(Deno.args[0]) async function do_work(key: string) { let progress = 0 while (progress < 1) { - await new Promise(r => setTimeout(r, 200)) + await new Promise(r => setTimeout(r, Math.random() * 400)) progress += 0.1 ws.send(JSON.stringify({ t: "metadata", key, data: { progress } })) } @@ -17,6 +17,7 @@ ws.onopen = () => { console.log("ws open"); ws.send(JSON.stringify({ t: "register", name: "dummy worker", task_kinds: ["youtube"] })) ws.send(JSON.stringify({ t: "accept" })) + ws.send(JSON.stringify({ t: "accept" })) } ws.onmessage = async ev => { if (typeof ev.data != "string") return -- cgit v1.2.3-70-g09d2