From e47f67dbe01272e83e27e6eafede736e925266fd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 7 Jun 2021 20:18:06 +0200 Subject: [PATCH] busy-wait.js: rename a method argument MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- busy-wait.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/busy-wait.js b/busy-wait.js index 9ff5a00..5ea20aa 100644 --- a/busy-wait.js +++ b/busy-wait.js @@ -15,30 +15,30 @@ function dummyTimeoutBusyWait (timeoutMs) { /** * @param timeoutMs - * @param delayMs + * @param intervalMs */ -async function divideAndConquerTimeoutBusyWait (timeoutMs, delayMs = 200) { - const tries = Math.round(timeoutMs / delayMs) +async function divideAndConquerTimeoutBusyWait (timeoutMs, intervalMs = 200) { + const tries = Math.round(timeoutMs / intervalMs) let count = 0 do { count++ - await sleep(delayMs) + await sleep(intervalMs) } while (count <= tries) } /** * @param timeoutMs - * @param delayMs + * @param intervalMs */ -function setIntervalTimeoutBusyWait (timeoutMs, delayMs = 200) { - const tries = Math.round(timeoutMs / delayMs) +function setIntervalTimeoutBusyWait (timeoutMs, intervalMs = 200) { + const tries = Math.round(timeoutMs / intervalMs) let count = 0 const triesSetInterval = setInterval(() => { count++ if (count === tries) { clearInterval(triesSetInterval) } - }, delayMs) + }, intervalMs) } suite -- 2.34.1