From 84fe5037b9fac063a2aaa1f539306edd9ec749e8 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Sun, 25 Sep 2022 14:34:21 +1000 Subject: [PATCH] Make the staggered start work properly --- haproxy/js/challenge.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/haproxy/js/challenge.js b/haproxy/js/challenge.js index 15b0457..b1b8192 100644 --- a/haproxy/js/challenge.js +++ b/haproxy/js/challenge.js @@ -57,10 +57,10 @@ const powFinished = new Promise((resolve, reject) => { argonWorker.onmessage = messageHandler; workers.push(argonWorker); } - workers.forEach(async (w, i) => { + for (let i = 0; i < threads; i++) { await new Promise(res => setTimeout(res, 100)); - w.postMessage([userkey, challenge, diffString, argonOpts, i, threads]); - }); + workers[i].postMessage([userkey, challenge, diffString, argonOpts, i, threads]); + } } else { console.warn('No webworker support, running in main/UI thread!'); let i = 0;