From 435df85b764018f420a59dd35a2c6371dfa270d3 Mon Sep 17 00:00:00 2001 From: shmck Date: Sun, 3 May 2020 13:25:57 -0700 Subject: [PATCH] fix test runner throttle Signed-off-by: shmck --- src/services/testRunner/throttle.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/testRunner/throttle.ts b/src/services/testRunner/throttle.ts index 7fa353c0..9658ffda 100644 --- a/src/services/testRunner/throttle.ts +++ b/src/services/testRunner/throttle.ts @@ -5,7 +5,7 @@ const THROTTLE_OFFSET = 300 // ms export const throttle = (): Date | null => { const now = new Date() - if (now.getTime() > lastRun.getTime() + THROTTLE_OFFSET) { + if (+now > +lastRun + THROTTLE_OFFSET) { lastRun = now return lastRun } @@ -14,4 +14,4 @@ export const throttle = (): Date | null => { // quick solution to prevent processing multiple results // NOTE: may be possible to kill child process early if we migrate to tasks -export const debounce = (startTime: Date): boolean => lastRun === startTime +export const debounce = (startTime: Date): boolean => +lastRun < +startTime + THROTTLE_OFFSET