aboutsummaryrefslogtreecommitdiff
path: root/scripts/dummy_worker.ts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/dummy_worker.ts')
-rw-r--r--scripts/dummy_worker.ts3
1 files changed, 2 insertions, 1 deletions
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