mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
No need to div/multiply
This commit is contained in:
@ -85,7 +85,7 @@ const powFinished = new Promise((resolve, reject) => {
|
|||||||
let finished = false;
|
let finished = false;
|
||||||
const messageHandler = (e) => {
|
const messageHandler = (e) => {
|
||||||
if (e.data.length === 1) {
|
if (e.data.length === 1) {
|
||||||
const totalHashes = e.data[0]*workerThreads; //assumes all worker threads are same speed
|
const totalHashes = e.data[0]; //assumes all worker threads are same speed
|
||||||
const elapsedSec = Math.floor((Date.now()-start)/1000);
|
const elapsedSec = Math.floor((Date.now()-start)/1000);
|
||||||
const hps = Math.floor(totalHashes/elapsedSec);
|
const hps = Math.floor(totalHashes/elapsedSec);
|
||||||
const requiredSec = Math.floor(eHashes/hps) * 1.5; //estimate 1.5x time
|
const requiredSec = Math.floor(eHashes/hps) * 1.5; //estimate 1.5x time
|
||||||
|
@ -6,7 +6,7 @@ onmessage = async function(e) {
|
|||||||
let i = id;
|
let i = id;
|
||||||
if (id === 0) {
|
if (id === 0) {
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
postMessage([i/threads]);
|
postMessage([i]);
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
while(true) {
|
while(true) {
|
||||||
|
Reference in New Issue
Block a user