diff options
-rw-r--r-- | scripts/ytdlp_download.ts | 2 | ||||
-rw-r--r-- | src/worker_ws.rs | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/scripts/ytdlp_download.ts b/scripts/ytdlp_download.ts index bc9afd7..b6be66d 100644 --- a/scripts/ytdlp_download.ts +++ b/scripts/ytdlp_download.ts @@ -110,7 +110,9 @@ ws.onmessage = async ev => { if (p.t == "config") config = p.config if (p.t == "error") console.error(`error: ${p.message}`); if (p.t == "work") { + console.log("work"); await do_download(p.key, p.data) + console.log("accept"); ws.send(JSON.stringify({ t: "accept" })) } } diff --git a/src/worker_ws.rs b/src/worker_ws.rs index fa43721..b057ca1 100644 --- a/src/worker_ws.rs +++ b/src/worker_ws.rs @@ -303,8 +303,8 @@ impl State { pub fn dispatch_work(&mut self) { let mut to_send = Vec::new(); for (id, w) in &mut self.workers { - if w.accept >= 1 { - for kind in &w.task_kinds { + for kind in &w.task_kinds { + if w.accept > 0 { let prefix = format!("{kind}:"); let Some(first) = self.queue.iter().find(|e| e.starts_with(&prefix)).cloned() else { |