X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=busy-wait.mjs;h=5a55ef82ef85164839bc476d84c631b4f03eb720;hb=0b694507b40b04ff7b905c0d3cade8d72ddc7cc9;hp=dd8a74f5a5c2faa69c3310b718d4542b1d7d614c;hpb=95d31631e49a5a39e261745c31f526691dab5f81;p=benchmarks-js.git diff --git a/busy-wait.mjs b/busy-wait.mjs index dd8a74f..5a55ef8 100644 --- a/busy-wait.mjs +++ b/busy-wait.mjs @@ -45,14 +45,14 @@ async function divideAndConquerTimeoutBusyWait ( * @param intervalMs */ async function setIntervalTimeoutBusyWait (timeoutMs, intervalMs = interval) { - return new Promise(resolve => { + await new Promise(resolve => { const tries = Math.round(timeoutMs / intervalMs) let count = 0 const triesSetInterval = setInterval(() => { count++ if (count === tries) { clearInterval(triesSetInterval) - return resolve() + resolve() } }, intervalMs) })