reduce concurrency of client check again to max 4 thread

This commit is contained in:
Thomas Lynch
2021-12-01 13:54:21 +11:00
parent b21cc9e90d
commit bc55ce5a93

View File

@ -13,7 +13,7 @@ if (window.Worker && crypto.subtle) {
const challenge = document.querySelector('[data-pow]').dataset.pow; const challenge = document.querySelector('[data-pow]').dataset.pow;
const difficulty = 0; const difficulty = 0;
const start = Date.now(); const start = Date.now();
const threads = Math.max(1,Math.floor(window.navigator.hardwareConcurrency/2)); const threads = Math.min(4,Math.ceil(window.navigator.hardwareConcurrency/2));
let finished = false; let finished = false;
const messageHandler = (e) => { const messageHandler = (e) => {
if (finished) { return; } if (finished) { return; }